From 72976f419136b599a0e6af8cd666d34502b2f716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 7 May 2011 11:36:16 +0100 Subject: [PATCH] Use internal _position in PlacedItem and transform it along when a matrix is applied. --- src/item/PlacedSymbol.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/item/PlacedSymbol.js b/src/item/PlacedSymbol.js index 49f08e18..b46deaa3 100644 --- a/src/item/PlacedSymbol.js +++ b/src/item/PlacedSymbol.js @@ -24,12 +24,14 @@ var PlacedSymbol = this.PlacedSymbol = Item.extend({ } else { this.symbol = new Symbol(symbol); } + this._position = this.symbol._definition.getPosition(); if (matrixOrOffset !== undefined) { if (matrixOrOffset instanceof Matrix) { this.matrix = matrixOrOffset; } else { this.matrix = new Matrix().translate(Point.read(arguments, 1)); } + this._position = this.matrix._transformPoint(this._position); } else { this.matrix = new Matrix(); } @@ -40,6 +42,12 @@ var PlacedSymbol = this.PlacedSymbol = Item.extend({ // raster, simply preconcatenate the internal matrix with the provided // one. this.matrix.preConcatenate(matrix); + // Transform position as well + this._position = matrix._transformPoint(this._position); + }, + + getPosition: function() { + return this._position.clone(); }, getBounds: function() {