mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Use internal _position in PlacedItem and transform it along when a matrix is applied.
This commit is contained in:
parent
34785534e0
commit
72976f4191
1 changed files with 8 additions and 0 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue