From a665a678efb1101c8f6396860f74bf146ec08073 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Thu, 11 Jun 2015 15:17:57 -0700 Subject: [PATCH] working... --- js/lattice/CompositeEditorLattice.js | 21 ++------------------- js/lattice/Lattice.js | 7 ++----- js/lattice/LatticeBase.js | 2 -- js/menus/CompositeMenu.js | 4 ++-- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js index 77ce53e1..896ca91a 100644 --- a/js/lattice/CompositeEditorLattice.js +++ b/js/lattice/CompositeEditorLattice.js @@ -20,17 +20,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }), __initialize: function(options){ - console.log(options); - console.log(this); - - if (options.id) this.set("id", options.id); - else this.set("id", this.cid); - - if (options.data){ - _.each(_.keys(data), function(key){ - self.set(key, data[key], {silent:true}); - }); - } + if (options.id === undefined) this.set("id", this.cid); }, initLatticeSubclass: function(subclass){ @@ -54,7 +44,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }, _changeRandomColor: function(){ - this.set("compositeColor", makeRandomColor()); + this.set("color", makeRandomColor()); }, makeNewCompositeMaterial: function(name){ @@ -84,13 +74,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre destroy: function(){ var self = this; - _.each(_.keys(CompositeEditorLattice), function(key){ - self[key] = null; - }); - _.each(_.keys(defaults), function(key){ - self.unset(key, {silent:true}); - }); - this.compositeCells = null; lattice.showCells(); } }); diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 96de87a7..8aa021f2 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -8,7 +8,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre var Lattice = LatticeBase.extend({ - defaults: _.extend(LatticeBase.prototype.defaults, { + defaults: _.extend(_.clone(LatticeBase.prototype.defaults), { units: "mm", @@ -248,10 +248,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre console.warn("composite editor already allocated"); self.compositeEditor.destroy(); } - self.compositeEditor = new CompositeEditorLattice({ - id: id, - data: data - }); + self.compositeEditor = new CompositeEditorLattice(_.extend({id:id}, data)); self.compositeEditor.initLatticeSubclass(self._getSubclassForLatticeType()); appState.set("currentNav", "navComposite"); }); diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index ee32cc55..ada87bb2 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -23,8 +23,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre initialize: function(options){ - console.log(this); - 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 diff --git a/js/menus/CompositeMenu.js b/js/menus/CompositeMenu.js index 00a953fb..aa793393 100644 --- a/js/menus/CompositeMenu.js +++ b/js/menus/CompositeMenu.js @@ -78,10 +78,10 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice'], function($, _ template: _.template('\ <a href="#" class="btn btn-halfWidth btn-lg btn-default importJSON">Load Composite</a>\ <a id="saveComposite" href="#" class="btn btn-halfWidth btn-lg pull-right btn-default">Save Composite</a><br/><br/>\ - Name: <input id="compositeName" data-property="compositeName" value="<%= compositeName %>" placeholder="Enter Name" class="seventyFiveWidth form-control textInput lattice" type="text"><br/><br/>\ + Name: <input id="compositeName" data-property="name" value="<%= name %>" placeholder="Enter Name" class="seventyFiveWidth form-control textInput lattice" type="text"><br/><br/>\ Bounding Box: ()<br/><br/>\ Display Color: \ - <input id="compositeColor" style="border-color: <%= compositeColor %> ;" data-property="compositeColor" value="<%= compositeColor %>" placeholder="Enter HEX" class="halfWidth lattice form-control hexInput" type="text"><br/><br/>\ + <input id="compositeColor" style="border-color: <%= color %> ;" data-property="color" value="<%= color %>" placeholder="Enter HEX" class="halfWidth lattice form-control hexInput" type="text"><br/><br/>\ <a id="newRandomColor" href="#" class="btn btn-block btn-lg btn-default">New Random Color</a><br/><br/>\ <a id="finishComposite" href="#" class="btn btn-block btn-lg btn-success">Finish Composite</a><br/>\ <a id="cancelComposite" href="#" class="btn btn-halfWidth btn-lg btn-default">Cancel / Exit</a>\ -- GitLab