From 0baff00fd5d747cf67bb2b59e81840ae26921523 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Thu, 17 Dec 2009 18:16:00 +0000 Subject: [PATCH] fixtransforms branch: Made point-based elements remap instead of use matrix(), also added possible fix for r357 git-svn-id: http://svg-edit.googlecode.com/svn/branches/fixtransforms@1057 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 46 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 1c698995..76217bdb 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -15,26 +15,7 @@ * ensure zooming works properly * ensure undo/redo works perfectly */ -/* - TODOs for Localizing: - - - rename tool_path to tool_fhpath in all localization files (already updated in UI and script) - - rename tool_poly to tool_path in all localization files (already updated in UI and script) - - rename poly_node_x to path_node_x globally - - rename poly_node_y to path_node_y globally - - rename svninfo_dim to svginfo_dim globally (typo) - - provide translations in all other non-EN lang.XX.js files for: - - path_node_x - - path_node_y - - seg_type - - straight_segments - - curve_segments - - tool_node_clone - - tool_node_delete - - selLayerLabel - - selLayerNames - - sidepanel_handle -*/ + var isWebkit = navigator.userAgent.indexOf("AppleWebKit") != -1; if(!window.console) { window.console = {}; @@ -1664,12 +1645,29 @@ function BatchCommand(text) { var angle = canvas.getRotationAngle(child); if(angle || hasMatrixTransform(childTlist)) { var em = matrixMultiply(tm, sm, tmn, m); - - // this does not appear to work, something wrong with my logic here var e2t = svgroot.createSVGTransform(); e2t.setMatrix(em); childTlist.clear(); childTlist.appendItem(e2t,0); + + // Remap all point-based elements + var ch = {}; + switch (child.tagName) { + case 'line': + ch.x1 = child.getAttribute("x1"); + ch.y1 = child.getAttribute("y1"); + ch.x2 = child.getAttribute("x2"); + ch.y2 = child.getAttribute("y2"); + case 'polyline': + case 'polygon': + ch.points = child.getAttribute("points"); + case 'path': + ch.d = child.getAttribute("d"); + remapElement(child, ch, em); + childTlist.clear(); + default: + break; + } } // if not rotated or skewed, push the [T][S][-T] down to the child else { @@ -3646,7 +3644,7 @@ function BatchCommand(text) { // identified, a ChangeElementCommand is created and stored on the stack for those attrs // this is done in when we recalculate the selected dimensions() var mouseUp = function(evt) - { + { var tempJustSelected = justSelected; justSelected = null; if (!started) return; @@ -5610,7 +5608,7 @@ function BatchCommand(text) { } }; - $(container).mouseup(mouseUp); + $(window).mouseup(mouseUp); $(container).mousedown(mouseDown); $(container).mousemove(mouseMove);