mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Make sure items produced outside of importSvg() are inserted in the same place inside the DOM.
This commit is contained in:
parent
dad30d15ec
commit
9f6e43454a
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue