diff --git a/js/cells/supercells/CompositeCell.js b/js/cells/supercells/CompositeCell.js index c260f68386c7ce7ab258d96646fcc96108b408c4..0547bbee1e933e05d50eea93412b42d78d450686 100644 --- a/js/cells/supercells/CompositeCell.js +++ b/js/cells/supercells/CompositeCell.js @@ -20,7 +20,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', CompositeCell.prototype._rotateCell = function(object3D){ if (lattice._zIndexRotation) { - return object3D.rotateZ(lattice._zIndexRotation(this.index)); + var index = this.getAbsoluteIndex(); + return object3D.rotateZ(lattice._zIndexRotationSuperCell(index)); } return DMASuperCell.prototype._rotateCell.call(this, object3D); }; diff --git a/js/highlighter/SuperCellHighlighter.js b/js/highlighter/SuperCellHighlighter.js index fc5f2b3485c81347322469634eb3f605990b08fe..c14bc71280d96d89919f7af8ab22ad5109c2629b 100644 --- a/js/highlighter/SuperCellHighlighter.js +++ b/js/highlighter/SuperCellHighlighter.js @@ -44,7 +44,8 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' var index = this.highlightedObject.getAbsoluteIndex(); if (Math.abs(direction.z) > 0.9) index.z+=1; else if (Math.abs(direction.z) < 0.1) index.z -=1; - this.mesh.rotation.set(0,0, lattice._zIndexRotation(index)); + if (appState._drawingWithCompositeMaterialType()) this.mesh.rotation.set(0,0, lattice._zIndexRotationSuperCell(index)); + else this.mesh.rotation.set(0,0, lattice._zIndexRotation(index)); } var superCellIndex = appState.get("superCellIndex"); diff --git a/js/lattice/latticeSubclasses/GIKLattice.js b/js/lattice/latticeSubclasses/GIKLattice.js index 639a42cf156e68d556b323a2e948d891114d2901..e677c707a88af8ba6b2c8a22593885d4d66d1adf 100644 --- a/js/lattice/latticeSubclasses/GIKLattice.js +++ b/js/lattice/latticeSubclasses/GIKLattice.js @@ -44,6 +44,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }, _zIndexRotation: function(index){ + if (index.z%2 == 0) return Math.PI/2; + return 0; + }, + + _zIndexRotationSuperCell: function(index){ if (index.z%2 != 0) return Math.PI/2; return 0; }, diff --git a/js/models/AppState.js b/js/models/AppState.js index 1f7c4641c64290125cb25a0e7f8f57333cfb1c1c..fde99e781ceeba2d8b9dca067b8e378c584f39ad 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -141,6 +141,10 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu } }, + _drawingWithCompositeMaterialType: function(){ + return this.get("materialType").substr(0,5) == "super"; + }, + _renderingOnOff: function(){ if (!this.get("turnOffRendering")) three.render(); },