From 1477598bb707ab1c68580f1e153daec568f00950 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 6 Oct 2015 11:33:56 -0400 Subject: [PATCH] managing events between navs --- js/cam/Cam.js | 7 +++---- js/cells/DMACell.js | 6 +++++- js/models/AppState.js | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/js/cam/Cam.js b/js/cam/Cam.js index 64fd5037..ec5e6d15 100644 --- a/js/cam/Cam.js +++ b/js/cam/Cam.js @@ -158,7 +158,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel if (appState.get("currentNav") == "navAssemble") { this._setDefaultMachineForLatticeType(); this._calculateNumMaterials(); - } + } else if (!this.isVisible() && this.get("assembler")) this.get("assembler").setVisibility(false); }, _setDefaultMachineForLatticeType: function(){ @@ -179,7 +179,6 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel _setCAMVisibility: function(){ var visible = this.isVisible(); - console.log(visible); // this.get("origin").visible = visible; // this.get("stock").visible = visible; if (visible && !this.get("assembler")) this.selectMachine(); @@ -217,8 +216,8 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel isVisible: function(){ var currentTab = appState.get("currentTab"); var currentNav = appState.get("currentNav"); - return (currentTab == "assemblerSetup" || currentTab == "cam" || currentTab == "animation" || currentNav == "navComm" - || currentTab == "editComponent"); + return ((currentTab == "assemblerSetup" || currentTab == "cam" || currentTab == "animation" + || currentTab == "editComponent") && currentNav == "navAssemble" || currentNav == "navComm"); }, diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index d533bfc5..e6650efc 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -219,6 +219,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' DMACell.prototype.show = function(mode){ this.object3D.visible = true; + this._setTransparent(false); this.setMode(mode); }; @@ -256,7 +257,10 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' }; DMACell.prototype.setTransparent = function(evalFunction){ - var transparent = evalFunction(this); + this._setTransparent(evalFunction(this)) + }; + + DMACell.prototype._setTransparent = function(transparent){ if (transparent == this.isTransparent) return; this.isTransparent = transparent; this._setTHREEMaterial(this.getMaterial(true)); diff --git a/js/models/AppState.js b/js/models/AppState.js index e07abab9..83806596 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -125,6 +125,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], } if (this.get("cellMode") == "hide") this.set("cellMode", "cell"); + this.lattice.showCells(); }, _materialTypeChanged: function(){ -- GitLab