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) { initialize: function(symbol, matrixOrOffset) {
this.base(); this.base();
if (symbol instanceof Symbol) { this.symbol = symbol instanceof Symbol ? symbol : new Symbol(symbol);
this.symbol = symbol; this.matrix = matrixOrOffset !== undefined
} else { ? matrixOrOffset instanceof Matrix
this.symbol = new Symbol(symbol); ? matrixOrOffset
} : new Matrix().translate(Point.read(arguments, 1))
this._position = this.symbol._definition.getPosition(); : new Matrix();
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();
}
}, },
_transform: function(matrix, flags) { _transform: function(matrix, flags) {