diff --git a/css/main.css b/css/main.css index 4b9fad6387d79f810115623e5354f5f41bc2e5bb..320a3185cc235754b896f8826d62a4a21872364c 100644 --- a/css/main.css +++ b/css/main.css @@ -307,17 +307,12 @@ input.intInput, input.floatInput{ z-index: 1; display: block; position: absolute; - margin: 0 auto; - left: 0; - right: 0; + margin: 0; + left: 40px; bottom: 35px; opacity: 0.75; } -#navRibbon .btn-toolbar{ - margin: 0 50px; - left: 0; - right: 0; -} + #navRibbon .btn-ribbon{ background-color: #444; diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index 1b53cd188b8f442e83ed434248d24f87ac1a9ea8..d020a0a68c0589f1b0c8319eeaba2e7da4ff073b 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -252,8 +252,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' setVisiblity(); break; case "part": - if (!this.parts) { - console.log(this); + if (!this.cells && !this.parts) { this._initParts(function(parts){ self.parts = parts; setVisiblity(); @@ -261,7 +260,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' } else setVisiblity(); break; case "beam": - if (!this.beams) this.beams = this._initBeams(function(){ + if (!this.cells && !this.beams) this.beams = this._initBeams(function(){ if (!this.nodes) this.nodes = self._initNodes(function(){ setVisiblity(); }); diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index 3e492fcb9c3ec6a6aacc90432fb81dae0264b05b..a5641e8f2a56b7faf670edda72fe58984d721f02 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -96,11 +96,6 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], - DMASuperCell.prototype.getLength = function(){ - if (this.cells && this.cells.length) return this.cells.length-1; - return appState.get("superCellRange").x-1;//zero indexed - }; - DMASuperCell.prototype._loopCells = function(callback){ var cells = this.cells; if (!cells || cells === undefined) return; diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js index 7d2d11edbdac6b1bc5c26d0eb1f248f76b1b19d3..00022aaa13d26d350aecc417b4dfa0fa999db759 100644 --- a/js/cells/supercells/GIKSuperCell.js +++ b/js/cells/supercells/GIKSuperCell.js @@ -17,7 +17,6 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', } function GIKSuperCell(json, superCell){ - console.log(json.length); this.length = json.length || appState.get("superCellRange").x; DMASuperCell.call(this, json, superCell); } @@ -30,7 +29,6 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', }; GIKSuperCell.prototype._makeSubCellForIndex = function(json, callback){ - console.log(json); json.materialName = this.materialName; callback(new GIKCell(json, this)); }; @@ -41,10 +39,13 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', return object3D; }; + GIKSuperCell.prototype.getLength = function(){ + return this.length; + }; + GIKSuperCell.prototype._getGeometry = function(){ - var length = this.getLength() + 1; - var key = "length"+length; - if (!unitGeos[key]) unitGeos[key] = makePartWithLength(length); + var key = "length"+this.length; + if (!unitGeos[key]) unitGeos[key] = makePartWithLength(this.length); return unitGeos[key]; }; diff --git a/js/highlighter/Highlighter.js b/js/highlighter/Highlighter.js index ea7b81666b68367a2d1886dd51266ed81a882fd2..4a29025fb2c36fa715a7d166c27a49db250ab1c3 100644 --- a/js/highlighter/Highlighter.js +++ b/js/highlighter/Highlighter.js @@ -47,6 +47,7 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' }, _setVisibility: function(visible, forceRender){ + if (!this.mesh) return; visible = appState.get("highlighterIsVisible") && visible; if (forceRender || this.isVisible() != visible){ this.mesh.visible = visible; diff --git a/js/highlighter/SuperCellHighlighter.js b/js/highlighter/SuperCellHighlighter.js index 0cf3da0b6225889bf2833cc7b04f6985372c86da..06bb48a7d192aa60e017b17c7ade6bf02dd66f47 100644 --- a/js/highlighter/SuperCellHighlighter.js +++ b/js/highlighter/SuperCellHighlighter.js @@ -28,8 +28,8 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' }, _setScale: function(){ - this.mesh.scale.set(appState.get("superCellRange").x, appState.get("superCellRange").y, - appState.get("superCellRange").z); + var superCellRange = appState.get("superCellRange"); + this.mesh.scale.set(superCellRange.x, superCellRange.y, superCellRange.z); }, _setPosition: function(position, direction){ @@ -55,8 +55,9 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' }, _superCellParamDidChange: function(){ - if (!this.mesh || !this.direction) return; + if (!this.mesh) return; this._setScale(); + if (!this.direction) return; this._setPosition(this.position, this.direction);//position of center point this._setRotation(this.direction); three.render(); diff --git a/js/materials/DMAMaterials.js b/js/materials/DMAMaterials.js index c77efd93978c552591255c38b3740b85c96acaff..b55e9d06cafb50b515d37bb0e61d635d5d05b079 100644 --- a/js/materials/DMAMaterials.js +++ b/js/materials/DMAMaterials.js @@ -29,7 +29,6 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu loadMaterialClass(); function loadMaterialClass(){ - console.log(appState.get("materialClass")); var materialClass = appState.get("materialClass"); var newDefaultType = _.keys(plist.allMaterials[materialClass])[0]; if (!materials[newDefaultType]) _.extend(materials, parseClassFromDefinitions(plist.allMaterials[materialClass])); diff --git a/js/menus/LatticeMenuView.js b/js/menus/LatticeMenuView.js index 4f98be5f487df3e9d715460fd7001e4bee7560b5..4aaa1845d6f4280b2475e3cf81515ae1b0430fe7 100644 --- a/js/menus/LatticeMenuView.js +++ b/js/menus/LatticeMenuView.js @@ -12,6 +12,7 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'text!latticeM _initialize: function(){ this.listenTo(lattice, "change", this.render); + this.listenTo(this.model, "change:superCellRange", this.render); }, _makeTemplateJSON: function(){ diff --git a/js/parts/GIKPart.js b/js/parts/GIKPart.js index 25f394be1db24bbcf97d879b57b0ac881a0f6990..d7bf74e6763357749a3b78c2dc8a55fc2501367a 100644 --- a/js/parts/GIKPart.js +++ b/js/parts/GIKPart.js @@ -32,12 +32,12 @@ define(['underscore', 'three', 'part', 'bin!gikPartSTL', 'bin!gikEndPartSTL', 's }; GIKPart.prototype._rotatePart = function(mesh){ - if (this._getGIKLength() == this.index) mesh.rotateZ(Math.PI); + if (this._getGIKLength()-1 == this.index) mesh.rotateZ(Math.PI); return mesh; }; GIKPart.prototype._isEnd = function(){ - return this.index == 0 || this.index == this._getGIKLength(); + return this.index == 0 || this.index == this._getGIKLength()-1; }; GIKPart.prototype._getGIKLength = function(){