mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -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 {
|
} else {
|
||||||
this.symbol = new Symbol(symbol);
|
this.symbol = new Symbol(symbol);
|
||||||
}
|
}
|
||||||
|
this._position = this.symbol._definition.getPosition();
|
||||||
if (matrixOrOffset !== undefined) {
|
if (matrixOrOffset !== undefined) {
|
||||||
if (matrixOrOffset instanceof Matrix) {
|
if (matrixOrOffset instanceof Matrix) {
|
||||||
this.matrix = matrixOrOffset;
|
this.matrix = matrixOrOffset;
|
||||||
} else {
|
} else {
|
||||||
this.matrix = new Matrix().translate(Point.read(arguments, 1));
|
this.matrix = new Matrix().translate(Point.read(arguments, 1));
|
||||||
}
|
}
|
||||||
|
this._position = this.matrix._transformPoint(this._position);
|
||||||
} else {
|
} else {
|
||||||
this.matrix = new Matrix();
|
this.matrix = new Matrix();
|
||||||
}
|
}
|
||||||
|
@ -40,6 +42,12 @@ var PlacedSymbol = this.PlacedSymbol = Item.extend({
|
||||||
// raster, simply preconcatenate the internal matrix with the provided
|
// raster, simply preconcatenate the internal matrix with the provided
|
||||||
// one.
|
// one.
|
||||||
this.matrix.preConcatenate(matrix);
|
this.matrix.preConcatenate(matrix);
|
||||||
|
// Transform position as well
|
||||||
|
this._position = matrix._transformPoint(this._position);
|
||||||
|
},
|
||||||
|
|
||||||
|
getPosition: function() {
|
||||||
|
return this._position.clone();
|
||||||
},
|
},
|
||||||
|
|
||||||
getBounds: function() {
|
getBounds: function() {
|
||||||
|
|
Loading…
Reference in a new issue