diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js index 1c9c010515ecc72735f13c8559c310e64248576e..c4bc280034f5bfc14807c9ee569c9ca93f19a8cf 100644 --- a/js/lattice/CompositeEditorLattice.js +++ b/js/lattice/CompositeEditorLattice.js @@ -19,12 +19,13 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre color: null }), - __initialize: function(options){ + __initialize: function(options, callback){ if (!options.id || options.id == "") this.set("id", this.cid); if (!options.color || options.color == "") this.set("color", makeRandomColor(), {silent:true}); this.set("numCells", 3);//todo remove this this.set("cellsMin", new THREE.Vector3(0,0,0)); this.set("cellsMax", new THREE.Vector3(0,0,0)); + if (callback) callback(this); }, initLatticeSubclass: function(subclass){ diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 90074f6dd02d7fc8c36cfab2b5b64a2ec27cb9ce..cbf054b177ea0c0274c9334468d9d886f382724c 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -253,9 +253,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre console.warn("composite editor already allocated"); self.compositeEditor.destroy(); } - self.compositeEditor = new CompositeEditorLattice(_.extend({id:id}, data)); - self.compositeEditor.initLatticeSubclass(self._getSubclassForLatticeType()); - appState.set("currentNav", "navComposite"); + self.compositeEditor = new CompositeEditorLattice(_.extend({id:id}, data), null, function(_self){ + _self.initLatticeSubclass(self._getSubclassForLatticeType()); + appState.set("currentNav", "navComposite"); + }); + }); }, diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 0e2db9350168b4074e4b925cb9ec1c3897d5d5e2..9714f965a4c9cb5f82af33da84c9db181195e45d 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -21,7 +21,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }, - initialize: function(options){ + initialize: function(options, classProperties, callback){ this.cells = [[[null]]];//3D matrix containing all cells and null, dynamic size this.sparseCells = [[[null]]];//3D matrix containing highest hierarchical level of cells and null @@ -32,7 +32,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre this.listenTo(appState, "change:cellsVisible", this._setCellVisibility); if (this.__bindEvents) this.__bindEvents(); - if (this.__initialize) this.__initialize(options); + if (this.__initialize) this.__initialize(options, callback); },