From bf1cd8606dc6db16a16e5e0d0ff0f3354ccfea10 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Mon, 7 Dec 2009 15:42:36 +0000 Subject: [PATCH] Updated lang.en.js file and added fixes to issues 346 and 347 to trunk git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1000 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/locale/lang.en.js | 11 +++++------ editor/svg-editor.js | 14 ++++++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/editor/locale/lang.en.js b/editor/locale/lang.en.js index 22ca7a61..271f2a04 100644 --- a/editor/locale/lang.en.js +++ b/editor/locale/lang.en.js @@ -28,13 +28,9 @@ {"id":"align_relative_to","title":"Align relative to ..."}, {"id":"tool_group","title":"Group Elements [G]"}, {"id":"tool_ungroup","title":"Ungroup Elements [G]"}, -{"id":"rect_x","title":"Change rectangle X coordinate"}, -{"id":"rect_y","title":"Change rectangle Y coordinate"}, {"id":"rect_width","title":"Change rectangle width"}, {"id":"rect_height","title":"Change rectangle height"}, {"id":"rect_rx","title":"Change Rectangle Corner Radius"}, -{"id":"image_x","title":"Change image X coordinate"}, -{"id":"image_y","title":"Change image Y coordinate"}, {"id":"image_width","title":"Change image width"}, {"id":"image_height","title":"Change image height"}, {"id":"image_url","title":"Change URL"}, @@ -49,8 +45,6 @@ {"id":"line_y1","title":"Change line's starting y coordinate"}, {"id":"line_x2","title":"Change line's ending x coordinate"}, {"id":"line_y2","title":"Change line's ending y coordinate"}, -{"id":"text_x","title":"Change text X coordinate"}, -{"id":"text_y","title":"Change text Y coordinate"}, {"id":"tool_bold","title":"Bold Text [B]"}, {"id":"tool_italic","title":"Italic Text [I]"}, {"id":"font_family","title":"Change Font Family"}, @@ -139,6 +133,11 @@ {"id":"icon_medium","textContent":"Medium"}, {"id":"icon_large","textContent":"Large"}, {"id":"icon_xlarge","textContent":"Extra Large"}, +{"id":"selected_x","title":"Change X coordinate"}, +{"id":"selected_y","title":"Change Y coordinate"}, +{"id":"tool_topath","title":"Convert to Path"}, +{"id":"tool_reorient","title":"Reorient path"}, +{"id":"tool_node_link","title":"Link Control Points"}, {"js_strings": { "invalidAttrValGiven":"Invalid value given", "noContentToFitTo":"No content to fit to", diff --git a/editor/svg-editor.js b/editor/svg-editor.js index c86d3391..529ab264 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -197,15 +197,20 @@ function svg_edit_setup() { // called when any element has changed var elementChanged = function(window,elems) { - // selectedElement must be updated here in case it was changed - selectedElement = (elems.length == 1 || elems[1] == null ? elems[0] : null); + for (var i = 0; i < elems.length; ++i) { var elem = elems[i]; + // if the element changed was the svg, then it could be a resolution change if (elem && elem.tagName == "svg" && elem.getAttribute("viewBox")) { var vb = elem.getAttribute("viewBox").split(' '); changeResolution(parseInt(vb[2]), parseInt(vb[3])); + } + // Update selectedElement if element is no longer part of the image. + // This occurs for the text elements in Firefox + else if(elem && selectedElement && selectedElement.parentNode == null) { + selectedElement = elem; } } @@ -340,8 +345,9 @@ function svg_edit_setup() { var updateContextPanel = function() { var elem = selectedElement; var currentLayer = svgCanvas.getCurrentLayer(); + var currentMode = svgCanvas.getMode(); // No need to update anything else in rotate mode - if (svgCanvas.getMode() == 'rotate' && elem != null) { + if (currentMode == 'rotate' && elem != null) { $('#angle').val(svgCanvas.getRotationAngle(elem)); return; } else if(svgCanvas.addedNew && elem != null && elname == 'image') { @@ -356,7 +362,7 @@ function svg_edit_setup() { var angle = svgCanvas.getRotationAngle(elem); $('#angle').val(angle); - if(!is_node) { + if(!is_node && currentMode != 'pathedit') { $('#selected_panel').show(); // Elements in this array already have coord fields if($.inArray(elname, ['line', 'circle', 'ellipse']) != -1) {