diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index f5a5c673555b796553b81139004557c676877214..7572fa303d92ed3fa11fa8153b02b896c638d32f 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -14,7 +14,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], DMACell.call(this, json, superCell); var material = this.getMaterial(); - var range = (new THREE.Vector3(1,1,1)).add(material.cellsMax).sub(material.cellsMin); + var range = appState.get("superCellRange"); + if (material.cellsMax) (new THREE.Vector3(1,1,1)).add(material.cellsMax).sub(material.cellsMin); this.cells = this._makeChildCells(range, material); DMACell.prototype.setMode.call(this, null, function(){ diff --git a/js/highlighter/SuperCellHighlighter.js b/js/highlighter/SuperCellHighlighter.js index 81edab6a010f25398d2d3547d6bad80927f5577b..7c649551da16a05e16fbb743e6f6e7e059bedeaf 100644 --- a/js/highlighter/SuperCellHighlighter.js +++ b/js/highlighter/SuperCellHighlighter.js @@ -38,7 +38,7 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' _setRotation: function(direction){ - if (lattice.connectionType == "gik"){ + if (lattice.get("connectionType") == "gik"){ if (!this.highlightedObject) return; var index = this.highlightedObject.getAbsoluteIndex(); diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js index 15b794af15f44edf02df3289a1bc2ecc8cfffa11..ba377065e7cbe191ca0556f3c23ca23e9da843da 100644 --- a/js/lattice/CompositeEditorLattice.js +++ b/js/lattice/CompositeEditorLattice.js @@ -19,19 +19,15 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre color: null }), + __bindEvents: function(){ + }, + __initialize: function(options, callback){ if (!options.id || options.id == "") this.set("id", "super" + this.cid); if (!options.color || options.color == "") this.set("color", makeRandomColor(), {silent:true}); if (callback) callback(this); }, - initLatticeSubclass: function(subclass){ - var self = this; - require([subclass], function(subclassObject){ - _.extend(self, subclassObject); - }); - }, - diff --git a/js/menus/CompositeMenu.js b/js/menus/CompositeMenu.js index 6a70086c4026a3e2fbc38da69131124778f80a5d..3f6dd62474ecbf36ea278bffa8fd3f2b4a2d7ab4 100644 --- a/js/menus/CompositeMenu.js +++ b/js/menus/CompositeMenu.js @@ -4,6 +4,8 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'globals'], function($, _, MenuParentView, plist, lattice, globals){ + var dimensions; + return MenuParentView.extend({ events: { @@ -20,8 +22,13 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'globals'], fu console.warn("no composite editor inited"); return; } - this.listenTo(lattice.compositeEditor, "change", this.render); + this.listenTo(lattice.compositeEditor, "change", function(){ + if (lattice.compositeEditor.changedAttributes().numCells !== undefined) dimensions = lattice.compositeEditor.calculateBoundingBox(); + this.render(); + }); this.listenTo(lattice, "change", this.render); + + dimensions = lattice.compositeEditor.calculateBoundingBox(); }, _changeRandomColor: function(e){ @@ -75,7 +82,7 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'globals'], fu { materialClass:lattice.get("materialClass"), materialType:lattice.get("materialType"), - dimensions: lattice.compositeEditor.calculateBoundingBox() + dimensions: dimensions }); },