diff --git a/editor/svg-editor.html b/editor/svg-editor.html index ed645aaa..3af21f6f 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -59,47 +59,47 @@ - + - + - + - +
| - + - + - +
| - + - + - + - +
| - + - + - + - +
diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 7cc20221..4d912722 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -182,6 +182,10 @@ function svg_edit_setup() { $('#rect_radius').change(function(){ svgCanvas.setRectRadius(this.options[this.selectedIndex].value); }); + + $('.attr_changer').change(function() { + svgCanvas.changeSelectedAttribute(this.getAttribute("alt"), this.value); + }); $('.palette_item').click(function(evt){ var id = (evt.shiftKey ? '#stroke_color' : '#fill_color'); diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index f4a85ea5..4a6b1672 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -937,6 +937,15 @@ function SvgCanvas(c) call("changed", selected); } } + + this.changeSelectedAttribute = function(attr, val) { + if (selected != null && selected.getAttribute(attr) != val) { + selected.setAttribute(attr, val); + selectedBBox = selected.getBBox(); + recalculateSelectedOutline(); + call("changed", selected); + } + } $(container).mouseup(mouseUp); $(container).mousedown(mouseDown);