Shorten PlacedSymbol#initialize().

This commit is contained in:
Jürg Lehni 2011-05-07 13:12:46 +01:00
parent 15b7cfec0b
commit 1413094be2

View file

@ -19,22 +19,12 @@ var PlacedSymbol = this.PlacedSymbol = Item.extend({
initialize: function(symbol, matrixOrOffset) {
this.base();
if (symbol instanceof Symbol) {
this.symbol = symbol;
} 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();
}
this.symbol = symbol instanceof Symbol ? symbol : new Symbol(symbol);
this.matrix = matrixOrOffset !== undefined
? matrixOrOffset instanceof Matrix
? matrixOrOffset
: new Matrix().translate(Point.read(arguments, 1))
: new Matrix();
},
_transform: function(matrix, flags) {