diff --git a/src/item/PlacedSymbol.js b/src/item/PlacedSymbol.js index 911016ad..85e1ae9a 100644 --- a/src/item/PlacedSymbol.js +++ b/src/item/PlacedSymbol.js @@ -99,7 +99,10 @@ var PlacedSymbol = Item.extend(/** @lends PlacedSymbol# */{ }, clone: function(insert) { - return this._clone(new PlacedSymbol(this.symbol), insert); + return this._clone(new PlacedSymbol({ + symbol: this.symbol, + insert: false + }), insert); }, isEmpty: function() { diff --git a/src/item/Raster.js b/src/item/Raster.js index 0cbce496..94b8b007 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -94,14 +94,17 @@ var Raster = Item.extend(/** @lends Raster# */{ }, clone: function(insert) { - var element = this._image; - if (!element) { + var param = { insert: false }, + image = this._image; + if (image) { + param.image = image; + } else { // If the Raster contains a Canvas object, we need to create // a new one and draw this raster's canvas on it. - element = CanvasProvider.getCanvas(this._size); - element.getContext('2d').drawImage(this._canvas, 0, 0); + var canvas = param.canvas = CanvasProvider.getCanvas(this._size); + canvas.getContext('2d').drawImage(this._canvas, 0, 0); } - return this._clone(new Raster(element), insert); + return this._clone(new Raster(param), insert); }, /** diff --git a/src/path/Path.js b/src/path/Path.js index bf7dcc8d..7813cfca 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -91,7 +91,11 @@ var Path = PathItem.extend(/** @lends Path# */{ }, clone: function(insert) { - var copy = this._clone(new Path(this._segments), insert); + var copy = this._clone(new Path({ + segments: this._segments, + insert: false + }), insert); + // Speed up things a little by copy over values that don't need checking copy._closed = this._closed; if (this._clockwise !== undefined) copy._clockwise = this._clockwise; diff --git a/src/text/PointText.js b/src/text/PointText.js index 1b4561b9..2097a33f 100644 --- a/src/text/PointText.js +++ b/src/text/PointText.js @@ -48,7 +48,7 @@ var PointText = TextItem.extend(/** @lends PointText# */{ }, clone: function(insert) { - return this._clone(new PointText(), insert); + return this._clone(new PointText({ insert: false }), insert); }, /**