Have PathItem#setPathData() clear the previous content.

This commit is contained in:
Jürg Lehni 2013-03-03 16:56:48 -08:00
parent 8a69fcd1e5
commit 849d3efc2e
2 changed files with 10 additions and 4 deletions

View file

@ -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

View file

@ -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],