diff --git a/js/baseplane/SquareBasePlane.js b/js/baseplane/SquareBasePlane.js index def953f2a479275c94c648a87a19dc410f95e82c..8f3f17e32d0738ebe342a65314910a084ec8163e 100644 --- a/js/baseplane/SquareBasePlane.js +++ b/js/baseplane/SquareBasePlane.js @@ -35,15 +35,15 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'threeModel', 'three', var mesh = new THREE.Mesh(planeGeometry, new THREE.MeshBasicMaterial({color:0x000000, transparent:true, opacity:0.0})); return [mesh, new THREE.Line(geometry, new THREE.LineBasicMaterial({color:0x000000, transparent:true, linewidth:2, opacity:this.get("material").opacity}), THREE.LinePieces)]; - }, - - _renderZIndexChange: function(){ - var zIndex = this.get("zIndex"); - var zScale = lattice.zScale(); - _.each(this.get("mesh"), function(mesh){ - mesh.position.set(0, 0, zIndex*zScale); - }); - three.render(); - }, + } + +// _renderZIndexChange: function(){ +// var zIndex = this.get("zIndex"); +// var zScale = lattice.zScale(); +// _.each(this.get("mesh"), function(mesh){ +// mesh.position.set(0, 0, zIndex*zScale); +// }); +// three.render(); +// }, }); }); diff --git a/js/highlighter/SuperCellHighlighter.js b/js/highlighter/SuperCellHighlighter.js index 8a0a1f1204b432237d29fc3cf2b2a4a4ff39a061..3fdd65892204acfbf907aff413cb14c7b9569dd7 100644 --- a/js/highlighter/SuperCellHighlighter.js +++ b/js/highlighter/SuperCellHighlighter.js @@ -24,8 +24,10 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' }, _setPosition: function(position, direction){ + console.log(position); this.mesh.position.set(position.x+lattice.xScale()*direction.x/2, position.y+lattice.yScale()*direction.y/2, position.z+lattice.zScale()*direction.z/2); + console.log(this.mesh.position); }, _setRotation: function(direction){ @@ -37,9 +39,9 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' else this.mesh.rotation.set(0,0,0); var superCellIndex = appState.get("superCellIndex"); - this.mesh.translateX((superCellIndex.x + 0.5)*lattice.xScale() - this.mesh.scale.x/2); - this.mesh.translateY((superCellIndex.y + 0.5)*lattice.yScale() - this.mesh.scale.y/2); - this.mesh.translateZ((superCellIndex.z + 0.5)*lattice.zScale() - this.mesh.scale.z/2); + this.mesh.translateX(-((superCellIndex.x + 0.5)*lattice.xScale() - this.mesh.scale.x/2)); + this.mesh.translateY(-((superCellIndex.y + 0.5)*lattice.yScale() - this.mesh.scale.y/2)); + this.mesh.translateZ(-((superCellIndex.z + 0.5)*lattice.zScale() - this.mesh.scale.z/2)); }, _superCellParamDidChange: function(){ @@ -52,18 +54,10 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' _getNextCellPosition: function(){//add direction vector to current index var newIndex = this.highlightedObject.getAbsoluteIndex(); - console.log(this.highlightedObject.index); - var direction = this.direction; - _.each(_.keys(newIndex), function(key){ - newIndex[key] = Math.round(newIndex[key] + direction[key]); - }); - - console.log(newIndex); - - var offset = appState.get("superCellIndex"); -// this.highlightedObject. - if (newIndex.z%2 == 0) newIndex.x -= offset.x; - else newIndex.y -= offset.x; + newIndex.add(this.direction.clone()).round(); + var offset = appState.get("superCellIndex").clone(); + offset.applyQuaternion(this.mesh.quaternion).round(); + newIndex.sub(offset); return newIndex; } });