From 7c5c80beec62961998cb4f742583722b08940e2d Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Wed, 24 Jun 2009 04:33:09 +0000 Subject: [PATCH] Fix Issue 26: context tools for rect, circle, ellipse, line are now editable git-svn-id: http://svg-edit.googlecode.com/svn/trunk@188 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.html | 30 +++++++++++++++--------------- editor/svg-editor.js | 4 ++++ editor/svgcanvas.js | 9 +++++++++ 3 files changed, 28 insertions(+), 15 deletions(-) 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);