From ddbbd53bf6d7f3ae049da41afb0c6adb3d4a374b Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Fri, 8 Oct 2010 19:48:55 +0000 Subject: [PATCH] Fixed issue 377: Raster images don't invert git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1790 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index f2b34de8..941a7444 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -3038,15 +3038,26 @@ var remapElement = this.remapElement = function(selected,changes,m) { case "foreignObject": case "rect": case "image": - var pt1 = remap(changes.x,changes.y); - changes.width = scalew(changes.width); - changes.height = scaleh(changes.height); - - changes.x = pt1.x + Math.min(0,changes.width); - changes.y = pt1.y + Math.min(0,changes.height); - changes.width = Math.abs(changes.width); - changes.height = Math.abs(changes.height); + // Allow images to be inverted (give them matrix when flipped) + if(elName === 'image' && (m.a < 0 || m.d < 0)) { + // Convert to matrix + var chlist = getTransformList(selected); + var mt = svgroot.createSVGTransform(); + mt.setMatrix(matrixMultiply(transformListToTransform(chlist).matrix,m)); + chlist.clear(); + chlist.appendItem(mt); + } else { + var pt1 = remap(changes.x,changes.y); + + changes.width = scalew(changes.width); + changes.height = scaleh(changes.height); + + changes.x = pt1.x + Math.min(0,changes.width); + changes.y = pt1.y + Math.min(0,changes.height); + changes.width = Math.abs(changes.width); + changes.height = Math.abs(changes.height); + } finishUp(); break; case "ellipse":