Make sure items produced outside of importSvg() are inserted in the same place inside the DOM.

This commit is contained in:
Jürg Lehni 2012-11-10 11:28:00 -08:00
parent dad30d15ec
commit 9f6e43454a

View file

@ -68,9 +68,9 @@ new function() {
} }
function clipItem(item, clip) { function clipItem(item, clip) {
if (clip instanceof Rectangle)
clip = new Path.Rectangle(clip);
var group = new Group(clip); var group = new Group(clip);
// Make sure group stays in the same place in the DOM as item:
group.moveAbove(item);
group.addChild(item); group.addChild(item);
group.setClipped(true); group.setClipped(true);
return group; return group;
@ -437,7 +437,7 @@ new function() {
rectangle.setSize(size); rectangle.setSize(size);
rectangle.setPoint(0); rectangle.setPoint(0);
// TODO: the viewbox does not always need to be clipped // TODO: the viewbox does not always need to be clipped
item = clipItem(item, rectangle); item = clipItem(item, new Path.Rectangle(rectangle));
break; break;
} }
} }