diff --git a/src/item/Item.js b/src/item/Item.js index 65c5519e..a2c4acef 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -71,19 +71,20 @@ var Item = Base.extend(Callback, /** @lends Item# */{ _initialize: function(props, point) { // Define this Item's unique id. But allow the creation of internally // used paths with no ids. - var internal = props && props.internal === true; + var internal = props && props.internal === true, + matrix = this._matrix = new Matrix(); + project = paper.project; if (!internal) this._id = Item._id = (Item._id || 0) + 1; // Handle matrix before everything else, to avoid issues with // #addChild() calling _changed() and accessing _matrix already. - var matrix = this._matrix = new Matrix(); if (point) matrix.translate(point); matrix._owner = this; + this._style = new Style(project._currentStyle, this); // If _project is already set, the item was already moved into the DOM // hierarchy. Used by Layer, where it's added to project.layers instead if (!this._project) { - var project = paper.project; // Do not insert into DOM if it's an internal path or // props.insert is false. if (internal || props && props.insert === false) { @@ -94,7 +95,6 @@ var Item = Base.extend(Callback, /** @lends Item# */{ (project.activeLayer || new Layer()).addChild(this); } } - this._style = new Style(this._project._currentStyle, this); return props ? this._set(props, { insert: true }) : true; },