diff --git a/src/item/Item.js b/src/item/Item.js index dc2e42b2..86153b70 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -110,6 +110,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ paper.project.activeLayer.addChild(this); this._style = PathStyle.create(this); this.setStyle(this._project.getCurrentStyle()); + this._matrix = new Matrix(); }, /** @@ -715,6 +716,8 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ if (this.hasOwnProperty(key)) copy[key] = this[key]; } + // Use Matrix#initialize to easily copy over values. + copy._matrix.initialize(this._matrix); // Copy over the selection state, use setSelected so the item // is also added to Project#selectedItems if it is selected. copy.setSelected(this._selected); @@ -1303,6 +1306,10 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ // Scriptographer behaves weirdly then too. if (!children || children.length == 0) return new Rectangle(); + // Concate the nate the passed matrix with the inner one, or start with + // one. + matrix = matrix ? matrix.clone().concatenate(this._matrix) + : this._matrix; var x1 = Infinity, x2 = -x1, y1 = x1, diff --git a/src/item/PlacedSymbol.js b/src/item/PlacedSymbol.js index 30d66f3b..b7f67700 100644 --- a/src/item/PlacedSymbol.js +++ b/src/item/PlacedSymbol.js @@ -101,8 +101,7 @@ var PlacedSymbol = this.PlacedSymbol = PlacedItem.extend(/** @lends PlacedSymbol draw: function(ctx, param) { if (param.selection) { - Item.drawSelectedBounds(this.symbol._definition.getStrokeBounds(), - ctx, this._matrix); + Item.drawSelectedBounds(this._getBounds('bounds'), ctx, this._matrix); } else { ctx.save(); this._matrix.applyToContext(ctx); diff --git a/src/item/Raster.js b/src/item/Raster.js index 63cb8eb0..4d5d9907 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -55,7 +55,6 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ /*#*/ } // options.server this.setImage(object); } - this._matrix = new Matrix(); }, clone: function() { @@ -67,7 +66,6 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ image.getContext('2d').drawImage(this._canvas, 0, 0); } var copy = new Raster(image); - copy._matrix = this._matrix.clone(); return this._clone(copy); }, diff --git a/src/text/PointText.js b/src/text/PointText.js index 638b75ab..5bc9215c 100644 --- a/src/text/PointText.js +++ b/src/text/PointText.js @@ -42,10 +42,7 @@ var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{ }, clone: function() { - var copy = this._clone(new PointText(this._point)); - // Use Matrix#initialize to easily copy over values. - copy._matrix.initialize(this._matrix); - return copy; + return this._clone(new PointText(this._point)); }, /**