Fix bug: If SVG source was changed, selectorParentGroup was thrown away meaning you could no longer create a poly

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@387 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2009-08-16 02:48:00 +00:00
parent a69ea2ed1d
commit 299cf0215c
2 changed files with 23 additions and 13 deletions

View File

@@ -1770,7 +1770,7 @@ function SvgCanvas(c)
// this function returns false if the set was unsuccessful, true otherwise
// TODO: should this function keep throwing the exception?
// FIXME: after parsing in the new file, how do we synchronize getId()?
// TODO: after parsing in the new text, do we need to synchronize getId()?
this.setSvgString = function(xmlString) {
try {
// convert string into XML document
@@ -1781,6 +1781,9 @@ function SvgCanvas(c)
var batchCmd = new BatchCommand("Change Source");
// save our old selectorParentGroup
selectorManager.selectorParentGroup = svgroot.removeChild(selectorManager.selectorParentGroup);
// remove old root
var oldroot = container.removeChild(svgroot);
batchCmd.addSubCommand(new RemoveElementCommand(oldroot, container));
@@ -1789,6 +1792,9 @@ function SvgCanvas(c)
svgroot = container.appendChild(svgdoc.importNode(newDoc.documentElement, true));
batchCmd.addSubCommand(new InsertElementCommand(svgroot));
// add back in parentSelectorGroup
svgroot.appendChild(selectorManager.selectorParentGroup);
addCommandToHistory(batchCmd);
call("changed", [svgroot]);
} catch(e) {
@@ -2040,6 +2046,10 @@ function SvgCanvas(c)
current_stroke_opacity = val;
this.changeSelectedAttribute("stroke-opacity", val);
};
this.setRotationAngle = function(val) {
console.log(val);
};
this.each = function(cb) {
$(svgroot).children().each(cb);