MCPcopy
hub / github.com/methodofaction/Method-Draw / mouseUp

Function mouseUp

src/js/svgcanvas.js:3020–3319  ·  view source on GitHub ↗
(evt)

Source from the content-addressed store, hash-verified

3018 // identified, a ChangeElementCommand is created and stored on the stack for those attrs
3019 // this is done in when we recalculate the selected dimensions()
3020 var mouseUp = function(evt)
3021 {
3022 canvas.addClones = false;
3023 window.removeEventListener("keyup", canvas.removeClones)
3024 selectedElements = selectedElements.filter(Boolean)
3025 if(evt.button === 2) return;
3026 var tempJustSelected = justSelected;
3027 justSelected = null;
3028 if (!started) return;
3029 var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
3030 mouse_x = pt.x * current_zoom,
3031 mouse_y = pt.y * current_zoom,
3032 x = mouse_x / current_zoom,
3033 y = mouse_y / current_zoom,
3034 element = getElem(getId()),
3035 keep = false;
3036
3037 var real_x = x;
3038 var real_y = y;
3039
3040 // TODO: Make true when in multi-unit mode
3041 var useUnit = false; // (curConfig.baseUnit !== 'px');
3042 started = false;
3043 switch (current_mode)
3044 {
3045 // intentionally fall-through to select here
3046 case "resize":
3047 case "multiselect":
3048 if (rubberBox != null) {
3049 rubberBox.setAttribute("display", "none");
3050 curBBoxes = [];
3051 }
3052 current_mode = "select";
3053 case "select":
3054 if (selectedElements[0] != null) {
3055 // if we only have one selected element
3056 if (selectedElements.length === 1) {
3057 // set our current stroke/fill properties to the element's
3058 var selected = selectedElements[0];
3059 switch ( selected.tagName ) {
3060 case "g":
3061 case "use":
3062 case "image":
3063 case "foreignObject":
3064 break;
3065 default:
3066 cur_properties.fill = selected.getAttribute("fill");
3067 cur_properties.fill_opacity = selected.getAttribute("fill-opacity");
3068 cur_properties.stroke = selected.getAttribute("stroke");
3069 cur_properties.stroke_opacity = selected.getAttribute("stroke-opacity");
3070 cur_properties.stroke_width = selected.getAttribute("stroke-width");
3071 cur_properties.stroke_dasharray = selected.getAttribute("stroke-dasharray");
3072 cur_properties.stroke_linejoin = selected.getAttribute("stroke-linejoin");
3073 cur_properties.stroke_linecap = selected.getAttribute("stroke-linecap");
3074 }
3075 if (selected.tagName == "text") {
3076 cur_text.font_size = selected.getAttribute("font-size");
3077 cur_text.font_family = selected.getAttribute("font-family");

Callers

nothing calls this directly

Calls 2

$Function · 0.85
addCommandToHistoryFunction · 0.85

Tested by

no test coverage detected