From e4175d974092029d15f1eb98eae53455b96d0cf4 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 30 Jun 2015 16:28:12 -0700 Subject: [PATCH] setting up parse cells method --- js/lattice/Lattice.js | 24 ++++++++++++++++++++++++ js/lattice/LatticeBase.js | 3 +++ js/models/AppState.js | 6 +++--- js/plists/PList.js | 2 +- todo | 3 +++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 06cd6f96..e6444a22 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -127,6 +127,28 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre + //cells array + + _parseSparseCell: function(){ + this.cells = [[[null]]]; + if (this.get("numCells") == 0) { + console.warn("no cells in assembly"); + return; + } + + var bounds = this.calculateBoundingBox(); + var size = bounds.max.sub(bounds.min); + console.log(size); + + }, + + + + + + + + //3d ui addHighlightableCell: function(cell){ @@ -152,6 +174,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre _navChanged: function(){ var currentNav = appState.get("currentNav"); if (currentNav != "navComposite" && this.compositeEditor && this.exitCompositeEditing) this.exitCompositeEditing(); + if ((currentNav == "electronicNavSim" || currentNav == "mechanicalNavSim" || currentNav == "navAssemble") + && appState.previous("currentNav") == "navDesign") this._parseSparseCell(); }, getCompositeData: function(){ diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index ef6c404a..c0976ea0 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -419,6 +419,9 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre + + + //events _updatePartType: function(){ diff --git a/js/models/AppState.js b/js/models/AppState.js index d83de728..abe5cc9c 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -39,7 +39,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu realisticColorScheme: false, materialType: null, - materialClass: "mechanical", + materialClass: null, stockSimulationPlaying: false, manualSelectOrigin: false//mode that allows user ot select origin from existing cell @@ -106,10 +106,10 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu if (navSelection == "navDesign") { this.set("basePlaneIsVisible", true); this.set("highlighterIsVisible", true); + } else if (navSelection == "electronicNavSim" || navSelection == "mechanicalNavSim"){ + this.set("highlighterIsVisible", false); } else if (navSelection == "navAssemble"){ - require(['cam']); } - }, _materialTypeChanged: function(){ var materialType = this.get("materialType"); diff --git a/js/plists/PList.js b/js/plists/PList.js index 584a21ba..5fe339eb 100644 --- a/js/plists/PList.js +++ b/js/plists/PList.js @@ -105,7 +105,7 @@ define(['three'], function(THREE){ vertex: 'mechanical' }, cube: { - face: 'mechanical', + face: 'electronic', gik: 'electronic' }, truncatedCube: {face: 'mechanical'}, diff --git a/todo b/todo index 689cbfd8..2206ba8f 100644 --- a/todo +++ b/todo @@ -12,3 +12,6 @@ hierarchical material transformations -> change material of a cell, change in bulk rendering callbacks + + +highligher - check mode, do not add cells except in design/composite/material modes \ No newline at end of file -- GitLab