diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js new file mode 100644 index 0000000000000000000000000000000000000000..4cfc745e4f0f8e234bbe54d434abb9f0696d8f60 --- /dev/null +++ b/js/lattice/CompositeEditorLattice.js @@ -0,0 +1,38 @@ +/** + * Created by aghassaei on 6/10/15. + */ + + +define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'three', 'threeModel'], + function(_, Backbone, appState, lattice, globals, plist, THREE, three){ + + var defaults = { + compositeCells:[[[null]]], + compositeColor: null + }; + + var CompositeEditorLattice = { + + + + _initCompositeEditor: function(){ + + _.each(_.keys(defaults), function(key){ + this.set(key, defaults[key], {silent:true}); + }); + + }, + + _undoCompositeEditor: function(){ + var self = this; + _.each(_.keys(CompositeEditorLattice), function(key){ + self[key] = null; + }); + _.each(_.keys(defaults), function(key){ + this.unset(key, defaults[key], {silent:true}); + }); + } + }; + + return CompositeEditorLattice; +}); diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index b79e5827dffabe8641f0c02e12272d729dabd50e..f3a25d9dbf9f066125cbcc343325cdc8ce90b345 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -17,8 +17,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre cellsMax: null,//max position of cells matrix numCells: 0, - scale: 20, - //spacing for connectors/joints cellSeparation: {xy:0, z:0}, diff --git a/js/menus/CompositeMenu.js b/js/menus/CompositeMenu.js index 2b6903f370b8cbaeb75cab3a9a8a9a56c619ee11..5ea2a530be36c45ac0296b3a0b5160a730b73018 100644 --- a/js/menus/CompositeMenu.js +++ b/js/menus/CompositeMenu.js @@ -9,7 +9,8 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice'], function($, _ events: { "click #newRandomColor": "_changeRandomColor", "click #finishComposite": "_finishComposite", - "click #saveComposite": "_saveComposite" + "click #saveComposite": "_saveComposite", + "click #cancelComposite": "_cancelComposite" }, _initialize: function(){ @@ -37,7 +38,7 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice'], function($, _ _finishComposite: function(e){ e.preventDefault(); - + this.model.set("currentNav", "navDesign"); }, _saveComposite: function(e){ @@ -45,6 +46,11 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice'], function($, _ }, + _cancelComposite: function(e){ + e.preventDefault(); + this.model.set("currentNav", "navDesign"); + }, + _makeTemplateJSON: function(){ return _.extend(this.material); }, @@ -59,6 +65,7 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice'], function($, _ <input value="<%= color %>" placeholder="Enter HEX" class="halfWidth form-control" type="text"><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-block btn-lg btn-danger">Cancel / Exit</a><br/>\ \ ') diff --git a/js/models/AppState.js b/js/models/AppState.js index 4154fb40af6095406252e43cf0910f011daca1b8..f384d2ed80180aa7496892865d00e75eb503ec13 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -97,7 +97,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist'], function(_, B //update to last tab open in that section var navSelection = this.get("currentNav"); var nextTab = this.get("lastNavTab")[navSelection] || _.keys(plist.allMenuTabs[navSelection])[0]; - this.set("currentTab", nextTab); + this.set("currentTab", nextTab, {silent:true}); if (navSelection == "navDesign") { this.set("basePlaneIsVisible", true);