Fixed issue 547 and another icon size bug
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1569 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
f5a19b8fe7
commit
0b82668ed3
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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});
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue