mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
parent
eeb26436b0
commit
0eae0b6e4d
3 changed files with 17 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
- SVG Export: Fix error when `Item#matrix` is not invertible (#1580).
|
- SVG Export: Fix error when `Item#matrix` is not invertible (#1580).
|
||||||
- SVG Import: Fix gradient default values (#1632).
|
- SVG Import: Fix gradient default values (#1632).
|
||||||
|
- JSON Import: Prevent overriding `Item#insert()` (#1392).
|
||||||
|
|
||||||
# `0.12.1`
|
# `0.12.1`
|
||||||
|
|
||||||
|
|
|
@ -558,8 +558,16 @@ statics: /** @lends Base */{
|
||||||
if (args.length === 1 && obj instanceof Item
|
if (args.length === 1 && obj instanceof Item
|
||||||
&& (useTarget || !(obj instanceof Layer))) {
|
&& (useTarget || !(obj instanceof Layer))) {
|
||||||
var arg = args[0];
|
var arg = args[0];
|
||||||
if (Base.isPlainObject(arg))
|
if (Base.isPlainObject(arg)) {
|
||||||
arg.insert = false;
|
arg.insert = false;
|
||||||
|
// When using target, make sure the `item.insert()`
|
||||||
|
// method is not overridden with the `arg.insert`
|
||||||
|
// property that was just set. Pass an exclude
|
||||||
|
// object to the call of `obj.set()` below (#1392).
|
||||||
|
if (useTarget) {
|
||||||
|
args = args.concat([{ insert: true }])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// When reusing an object, initialize it through #set()
|
// When reusing an object, initialize it through #set()
|
||||||
// instead of the constructor function:
|
// instead of the constructor function:
|
||||||
|
|
|
@ -256,3 +256,10 @@ test('Path#importJSON()', function() {
|
||||||
equals(function() { return layer.firstChild === path; }, true);
|
equals(function() { return layer.firstChild === path; }, true);
|
||||||
equals(function() { return path.parent === layer; }, true);
|
equals(function() { return path.parent === layer; }, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Item#importJSON() does not override Item#insert()', function() {
|
||||||
|
var path = new Path();
|
||||||
|
equals(typeof path.insert, 'function');
|
||||||
|
path.importJSON(path.exportJSON());
|
||||||
|
equals(typeof path.insert, 'function');
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue