Hide svgTransformLists from svgcanvas. Fix test HTML file.

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1838 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2010-11-05 14:59:59 +00:00
parent 16ea2a36a5
commit 5e140062b8
2 changed files with 22 additions and 17 deletions

View File

@ -643,9 +643,7 @@ var ChangeElementCommand = this.undoCmd.changeElement = function(elem, attrs, te
} }
// Remove transformlist to prevent confusion that causes bugs like 575. // Remove transformlist to prevent confusion that causes bugs like 575.
if (svgTransformLists[this.elem.id]) { svgedit.transformlist.removeElementFromListMap(this.elem);
delete svgTransformLists[this.elem.id];
}
return true; return true;
}; };
@ -708,9 +706,7 @@ var RemoveElementCommand = this.undoCmd.removeElement = function(elem, parent, t
// Function: RemoveElementCommand.apply // Function: RemoveElementCommand.apply
// Re-removes the new element // Re-removes the new element
this.apply = function() { this.apply = function() {
if (svgTransformLists[this.elem.id]) { svgedit.transformlist.removeElementFromListMap(this.elem);
delete svgTransformLists[this.elem.id];
}
this.parent = this.elem.parentNode; this.parent = this.elem.parentNode;
this.elem = this.parent.removeChild(this.elem); this.elem = this.parent.removeChild(this.elem);
@ -722,9 +718,7 @@ var RemoveElementCommand = this.undoCmd.removeElement = function(elem, parent, t
// Function: RemoveElementCommand.unapply // Function: RemoveElementCommand.unapply
// Re-adds the new element // Re-adds the new element
this.unapply = function() { this.unapply = function() {
if (svgTransformLists[this.elem.id]) { svgedit.transformlist.removeElementFromListMap(this.elem);
delete svgTransformLists[this.elem.id];
}
this.parent.insertBefore(this.elem, this.elem.nextSibling); this.parent.insertBefore(this.elem, this.elem.nextSibling);
@ -740,9 +734,7 @@ var RemoveElementCommand = this.undoCmd.removeElement = function(elem, parent, t
this.elements = function() { return [this.elem]; }; this.elements = function() { return [this.elem]; };
// special hack for webkit: remove this element's entry in the svgTransformLists map // special hack for webkit: remove this element's entry in the svgTransformLists map
if (svgTransformLists[elem.id]) { svgedit.transformlist.removeElementFromListMap(elem);
delete svgTransformLists[elem.id];
}
} }
// Function: MoveElementCommand // Function: MoveElementCommand
@ -1440,19 +1432,18 @@ var SelectorManager;
}; };
}()); }());
// "Import" from svgtransformlist.js // import svgtransformlist.js
var SVGEditTransformList = svgedit.transformlist.SVGTransformList; var SVGEditTransformList = svgedit.transformlist.SVGTransformList;
var svgTransformLists = svgedit.transformlist.transforms;
var getTransformList = this.getTransformList = svgedit.transformlist.getTransformList; var getTransformList = this.getTransformList = svgedit.transformlist.getTransformList;
// "Import" from svgutils.js // import from svgutils.js
var walkTree = this.walkTree = svgedit.Utilities.walkTree; var walkTree = this.walkTree = svgedit.Utilities.walkTree;
var walkTreePost = this.walkTreePost = svgedit.Utilities.walkTreePost; var walkTreePost = this.walkTreePost = svgedit.Utilities.walkTreePost;
var getUrlFromAttr = this.getUrlFromAttr = svgedit.Utilities.getUrlFromAttr; var getUrlFromAttr = this.getUrlFromAttr = svgedit.Utilities.getUrlFromAttr;
var getHref = this.getHref = svgedit.Utilities.getHref; var getHref = this.getHref = svgedit.Utilities.getHref;
var setHref = this.setHref = svgedit.Utilities.setHref; var setHref = this.setHref = svgedit.Utilities.setHref;
// "Import" from math.js. // import from math.js.
var transformPoint = svgedit.math.transformPoint; var transformPoint = svgedit.math.transformPoint;
var isIdentity = svgedit.math.isIdentity; var isIdentity = svgedit.math.isIdentity;
var matrixMultiply = this.matrixMultiply = svgedit.math.matrixMultiply; var matrixMultiply = this.matrixMultiply = svgedit.math.matrixMultiply;
@ -8163,7 +8154,7 @@ this.setSvgString = function(xmlString) {
current_zoom = 1; current_zoom = 1;
// reset transform lists // reset transform lists
svgTransformLists = {}; svgedit.transformlist.resetListMap();
clearSelection(); clearSelection();
pathActions.clearData(); pathActions.clearData();
svgroot.appendChild(selectorManager.selectorParentGroup); svgroot.appendChild(selectorManager.selectorParentGroup);

View File

@ -53,6 +53,20 @@ function transformToString(xform) {
*/ */
svgedit.transformlist.listMap = {}; svgedit.transformlist.listMap = {};
svgedit.transformlist.resetListMap = function() {
svgedit.transformlist.listMap = {};
};
/**
* Parameters:
* elem - a DOM Element
*/
svgedit.transformlist.removeElementFromListMap = function(elem) {
if (elem.id && svgedit.transformlist.listMap[elem.id]) {
delete svgedit.transformlist.listMap[elem.id];
}
};
// ************************************************************************************** // **************************************************************************************
// SVGTransformList implementation for Webkit // SVGTransformList implementation for Webkit