Made Image Title change undoable
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@845 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -52,6 +52,9 @@ var svgWhiteList = {
|
|||||||
"title": [],
|
"title": [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function SvgCanvas(c)
|
||||||
|
{
|
||||||
|
|
||||||
var toXml = function(str) {
|
var toXml = function(str) {
|
||||||
return str.replace("&", "&").replace("<", "<").replace(">",">");
|
return str.replace("&", "&").replace("<", "<").replace(">",">");
|
||||||
};
|
};
|
||||||
@@ -59,9 +62,6 @@ var fromXml = function(str) {
|
|||||||
return str.replace(">", ">").replace("<", "<").replace("&", "&");
|
return str.replace(">", ">").replace("<", "<").replace("&", "&");
|
||||||
};
|
};
|
||||||
|
|
||||||
function SvgCanvas(c)
|
|
||||||
{
|
|
||||||
|
|
||||||
var pathFuncsStrs = ['Moveto','Lineto','CurvetoCubic','CurvetoQuadratic','Arc','LinetoHorizontal','LinetoVertical','CurvetoCubicSmooth','CurvetoQuadraticSmooth']
|
var pathFuncsStrs = ['Moveto','Lineto','CurvetoCubic','CurvetoQuadratic','Arc','LinetoHorizontal','LinetoVertical','CurvetoCubicSmooth','CurvetoQuadraticSmooth']
|
||||||
var pathFuncs = [0,'ClosePath'];
|
var pathFuncs = [0,'ClosePath'];
|
||||||
$.each(pathFuncsStrs,function(i,s){pathFuncs.push(s+'Abs');pathFuncs.push(s+'Rel');});
|
$.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)
|
'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 scalew = function(w) {return (w*selectedBBox.width/box.width);}
|
||||||
var scaleh = function(h) {return (h*selectedBBox.height/box.height);}
|
var scaleh = function(h) {return (h*selectedBBox.height/box.height);}
|
||||||
|
|
||||||
@@ -3698,10 +3718,14 @@ function BatchCommand(text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setImageTitle = function(newtitle) {
|
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<childs.length; i++) {
|
for (var i=0; i<childs.length; i++) {
|
||||||
if(childs[i].nodeName == 'title') {
|
if(childs[i].nodeName == 'title') {
|
||||||
var doc_title = childs[i];
|
doc_title = childs[i];
|
||||||
|
old_title = doc_title.textContent;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3716,7 +3740,8 @@ function BatchCommand(text) {
|
|||||||
// No title given, so element is not necessary
|
// No title given, so element is not necessary
|
||||||
doc_title.parentNode.removeChild(doc_title);
|
doc_title.parentNode.removeChild(doc_title);
|
||||||
}
|
}
|
||||||
|
batchCmd.addSubCommand(new ChangeElementCommand(doc_title, {'#text': old_title}));
|
||||||
|
addCommandToHistory(batchCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setResolution = function(x, y) {
|
this.setResolution = function(x, y) {
|
||||||
|
|||||||
Reference in New Issue
Block a user