Fixed issue 377: Raster images don't invert

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1790 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-10-08 19:48:55 +00:00
parent 89a918a4f0
commit ddbbd53bf6
1 changed files with 19 additions and 8 deletions

View File

@ -3038,15 +3038,26 @@ var remapElement = this.remapElement = function(selected,changes,m) {
case "foreignObject": case "foreignObject":
case "rect": case "rect":
case "image": case "image":
var pt1 = remap(changes.x,changes.y);
changes.width = scalew(changes.width); // Allow images to be inverted (give them matrix when flipped)
changes.height = scaleh(changes.height); if(elName === 'image' && (m.a < 0 || m.d < 0)) {
// Convert to matrix
changes.x = pt1.x + Math.min(0,changes.width); var chlist = getTransformList(selected);
changes.y = pt1.y + Math.min(0,changes.height); var mt = svgroot.createSVGTransform();
changes.width = Math.abs(changes.width); mt.setMatrix(matrixMultiply(transformListToTransform(chlist).matrix,m));
changes.height = Math.abs(changes.height); 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(); finishUp();
break; break;
case "ellipse": case "ellipse":