diff --git a/editor/extensions/ext-eyedropper.js b/editor/extensions/ext-eyedropper.js index 35341c65..257650d7 100644 --- a/editor/extensions/ext-eyedropper.js +++ b/editor/extensions/ext-eyedropper.js @@ -16,7 +16,41 @@ svgEditor.addExtension("eyedropper", function(S) { currentStyle = {fillPaint: "red", fillOpacity: 1.0, strokePaint: "black", strokeOpacity: 1.0, strokeWidth: 5, strokeDashArray: null, - opacity: 1.0 }; + opacity: 1.0, + strokeLinecap: 'butt', + strokeLinejoin: 'miter', + }; + + function getStyle(opts) { + // if we are in eyedropper mode, we don't want to disable the eye-dropper tool + var mode = svgCanvas.getMode(); + if (mode == "eyedropper") return; + + var elem = null; + var tool = $('#tool_eyedropper'); + // enable-eye-dropper if one element is selected + if (opts.elems.length == 1 && opts.elems[0] && + $.inArray(opts.elems[0].nodeName, ['svg', 'g', 'use']) == -1) + { + elem = opts.elems[0]; + tool.removeClass('disabled'); + // grab the current style + currentStyle.fillPaint = elem.getAttribute("fill") || "black"; + currentStyle.fillOpacity = elem.getAttribute("fill-opacity") || 1.0; + currentStyle.strokePaint = elem.getAttribute("stroke"); + currentStyle.strokeOpacity = elem.getAttribute("stroke-opacity") || 1.0; + currentStyle.strokeWidth = elem.getAttribute("stroke-width"); + currentStyle.strokeDashArray = elem.getAttribute("stroke-dasharray"); + currentStyle.strokeLinecap = elem.getAttribute("stroke-linecap"); + currentStyle.strokeLinejoin = elem.getAttribute("stroke-linejoin"); + currentStyle.opacity = elem.getAttribute("opacity") || 1.0; + } + // disable eye-dropper tool + else { + tool.addClass('disabled'); + } + + } return { name: "eyedropper", @@ -33,33 +67,8 @@ svgEditor.addExtension("eyedropper", function(S) { }], // if we have selected an element, grab its paint and enable the eye dropper button - selectedChanged: function(opts) { - // if we are in eyedropper mode, we don't want to disable the eye-dropper tool - var mode = svgCanvas.getMode(); - if (mode == "eyedropper") return; - - var elem = null; - var tool = $('#tool_eyedropper'); - // enable-eye-dropper if one element is selected - if (opts.elems.length == 1 && opts.elems[0] && - $.inArray(opts.elems[0].nodeName, ['svg', 'g', 'use']) == -1) - { - elem = opts.elems[0]; - tool.removeClass('disabled'); - // grab the current style - currentStyle.fillPaint = elem.getAttribute("fill") || "black"; - currentStyle.fillOpacity = elem.getAttribute("fill-opacity") || 1.0; - currentStyle.strokePaint = elem.getAttribute("stroke"); - currentStyle.strokeOpacity = elem.getAttribute("stroke-opacity") || 1.0; - currentStyle.strokeWidth = elem.getAttribute("stroke-width"); - currentStyle.strokeDashArray = elem.getAttribute("stroke-dasharray"); - currentStyle.opacity = elem.getAttribute("opacity") || 1.0; - } - // disable eye-dropper tool - else { - tool.addClass('disabled'); - } - }, + selectedChanged: getStyle, + elementChanged: getStyle, mouseDown: function(opts) { var mode = svgCanvas.getMode(); @@ -81,6 +90,8 @@ svgEditor.addExtension("eyedropper", function(S) { if (currentStyle.strokeWidth) change(target, "stroke-width", currentStyle.strokeWidth); if (currentStyle.strokeDashArray) change(target, "stroke-dasharray", currentStyle.strokeDashArray); if (currentStyle.opacity) change(target, "opacity", currentStyle.opacity); + if (currentStyle.strokeLinecap) change(target, "stroke-linecap", currentStyle.strokeLinecap); + if (currentStyle.strokeLinejoin) change(target, "stroke-linejoin", currentStyle.strokeLinejoin); addToHistory(new ChangeElementCommand(target, changes)); } diff --git a/editor/svg-editor.css b/editor/svg-editor.css index 0f9ac93f..1e33e9d9 100644 --- a/editor/svg-editor.css +++ b/editor/svg-editor.css @@ -899,6 +899,11 @@ span.zoom_tool { z-index: 6; } +#bg_blocks { + overflow: auto; + margin-left: 30px; +} + #svg_docprops #svg_docprops_container { position: absolute; top: 50px; diff --git a/editor/svg-editor.js b/editor/svg-editor.js index a3aebe16..aa7940eb 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -2319,7 +2319,8 @@ $.resizeSvgIcons({ '.flyout_arrow_horiz > svg, .flyout_arrow_horiz > img': size_num / 5, - '#logo > svg, #logo > img': size_num * 1.3 + '#logo > svg, #logo > img': size_num * 1.3, + '#tools_bottom .icon_label > *': (size_num === 16 ? 18 : size_num * .75) }); if(size != 's') { $.resizeSvgIcons({'#layerbuttons svg, #layerbuttons img': size_num * .6}); diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index da1bd6e3..34b07b12 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -7604,6 +7604,7 @@ function BatchCommand(text) { } if (elems.length > 0) { this.changeSelectedAttribute("stroke-width", val, elems); + call("changed", selectedElements); } }; @@ -7622,6 +7623,7 @@ function BatchCommand(text) { } if (elems.length > 0) { this.changeSelectedAttribute(attr, val, elems); + call("changed", selectedElements); } };