diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js index 1c9f0b07ee487bfc70e0572601a555a3535de3c5..ade16c1f5692f04d3ed783da1f9f073c862512f9 100644 --- a/js/fea/DmaCell.js +++ b/js/fea/DmaCell.js @@ -163,7 +163,7 @@ DMACell.prototype.destroy = function(){ if (zIndex%2!=0) mesh.rotation.set(Math.PI,0,0); mesh.myParent = this;//we need a reference to this instance from the mesh for intersection selection stuff - dmaGlobals.three.sceneAdd(mesh, "inverseCell"); +// dmaGlobals.three.sceneAdd(mesh, "inverseCell"); mesh.visible = false; return mesh; }; diff --git a/js/models/BasePlane.js b/js/models/BasePlane.js index 9bfd363386078a1989f99c8daab3900b8305857c..81990ccc24c27c4e6eccbd61ca7402ccf41bc59c 100644 --- a/js/models/BasePlane.js +++ b/js/models/BasePlane.js @@ -181,6 +181,7 @@ OctaBasePlane = BasePlane.extend({ calcHighlighterPosition: function(face, position){ var index = dmaGlobals.lattice.getIndexForPosition(position); + if (index.z%2 != 0) index.x -= 1; index.z = this.get("zIndex") - 1;//pretend we're on the top of the cell underneath the baseplane var position = dmaGlobals.lattice.getPositionForIndex(index); position.z += dmaGlobals.lattice.zScale()/2; diff --git a/js/models/Lattice.js b/js/models/Lattice.js index 8bf03b4f71e3cbe9beef870ae1f9843ea24bf45a..3e806f73e7815cb7d3ae124676d052fef93a1743 100644 --- a/js/models/Lattice.js +++ b/js/models/Lattice.js @@ -399,7 +399,7 @@ Lattice = Backbone.Model.extend({ getIndexForPosition: function(absPosition){ var scale = this.get("scale"); var yIndex = Math.floor(absPosition.y/this.yScale(scale)); - if (Math.abs(yIndex%2) == 1) absPosition.x += this.xScale(scale)/2; + if (yIndex%2 != 0) absPosition.x += this.xScale(scale)/2; var index = this._indexForPosition(absPosition); if (index.z%2 == 1) index.y += 1; return index; @@ -434,7 +434,15 @@ Lattice = Backbone.Model.extend({ position.y = (position.y)*this.yScale(scale)-scale/Math.sqrt(3)/2; position.z = (position.z)*this.zScale(scale); } - if ((index.y%2) != 0) position.x -= this.xScale()/2; + if ((index.y%2) != 0) { + if (Math.round((index.y/2)%2) != 0) { + position.x -= this.xScale()/2; + } + } else { + if (Math.round((index.y/2)%2) != 0) { + position.x -= this.xScale(); + } + } return position; },