mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Have PathItem#setPathData() clear the previous content.
This commit is contained in:
parent
8a69fcd1e5
commit
849d3efc2e
2 changed files with 10 additions and 4 deletions
|
@ -95,14 +95,14 @@ var PlacedSymbol = this.PlacedSymbol = PlacedItem.extend(/** @lends PlacedSymbol
|
||||||
symbol._instances[this._id] = this;
|
symbol._instances[this._id] = this;
|
||||||
},
|
},
|
||||||
|
|
||||||
isEmpty: function() {
|
|
||||||
return this._symbol._definition.isEmpty();
|
|
||||||
},
|
|
||||||
|
|
||||||
clone: function() {
|
clone: function() {
|
||||||
return this._clone(new PlacedSymbol(this.symbol));
|
return this._clone(new PlacedSymbol(this.symbol));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isEmpty: function() {
|
||||||
|
return this._symbol._definition.isEmpty();
|
||||||
|
},
|
||||||
|
|
||||||
_getBounds: function(getter, matrix) {
|
_getBounds: function(getter, matrix) {
|
||||||
// Redirect the call to the symbol definition to calculate the bounds
|
// Redirect the call to the symbol definition to calculate the bounds
|
||||||
// TODO: Implement bounds caching through passing on of cacheItem, so
|
// TODO: Implement bounds caching through passing on of cacheItem, so
|
||||||
|
|
|
@ -101,6 +101,12 @@ var PathItem = this.PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First clear the previous content
|
||||||
|
if (this._type === 'Path')
|
||||||
|
this.removeSegments();
|
||||||
|
else
|
||||||
|
this.removeChildren();
|
||||||
|
|
||||||
for (var i = 0, l = parts.length; i < l; i++) {
|
for (var i = 0, l = parts.length; i < l; i++) {
|
||||||
var part = parts[i];
|
var part = parts[i];
|
||||||
cmd = part[0],
|
cmd = part[0],
|
||||||
|
|
Loading…
Reference in a new issue