Commit 79af4108 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

fixed gik rotation

parent 2cc38209
......@@ -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);
};
......
......@@ -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");
......
......@@ -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;
},
......
......@@ -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();
},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment