From 39e71579e3826c804d0b7e774b661a1027d2b171 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Tue, 20 Oct 2009 13:49:53 +0000 Subject: [PATCH] Made Image Title change undoable git-svn-id: http://svg-edit.googlecode.com/svn/trunk@845 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 04bb45e6..2f98b08c 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -52,6 +52,9 @@ var svgWhiteList = { "title": [], }; +function SvgCanvas(c) +{ + var toXml = function(str) { return str.replace("&", "&").replace("<", "<").replace(">",">"); }; @@ -59,9 +62,6 @@ var fromXml = function(str) { return str.replace(">", ">").replace("<", "<").replace("&", "&"); }; -function SvgCanvas(c) -{ - var pathFuncsStrs = ['Moveto','Lineto','CurvetoCubic','CurvetoQuadratic','Arc','LinetoHorizontal','LinetoVertical','CurvetoCubicSmooth','CurvetoQuadraticSmooth'] var pathFuncs = [0,'ClosePath']; $.each(pathFuncsStrs,function(i,s){pathFuncs.push(s+'Abs');pathFuncs.push(s+'Rel');}); @@ -1081,6 +1081,26 @@ function BatchCommand(text) { 'y':(((y-box.y)/box.height)*selectedBBox.height + selectedBBox.y) }; }; + + // Deal with flips, need to know when to flip_x/flip_y +// var remap = function(x,y) { +// // Prevent division by 0 +// if(!box.height) box.height = 1; +// if(!box.width) box.width = 1; +// +// var new_x = (((x-box.x)/box.width)*selectedBBox.width + selectedBBox.x); +// var new_y = (((y-box.y)/box.height)*selectedBBox.height + selectedBBox.y); +// +// if(flip_x) { +// new_x = selectedBBox.x + selectedBBox.width - (new_x - selectedBBox.x); +// } +// if(flip_y) { +// new_y = selectedBBox.y + selectedBBox.height - (new_y - selectedBBox.y); +// } +// +// return {x:new_x, y:new_y}; +// }; + var scalew = function(w) {return (w*selectedBBox.width/box.width);} var scaleh = function(h) {return (h*selectedBBox.height/box.height);} @@ -3698,10 +3718,14 @@ function BatchCommand(text) { } this.setImageTitle = function(newtitle) { - var childs = svgzoom.childNodes, doc_title = false; + var childs = svgzoom.childNodes, doc_title = false, old_title = ''; + + var batchCmd = new BatchCommand("Change Image Title"); + for (var i=0; i