From fbed7b1438c8b98e05081f5ffbaf4e2bdb102d2c Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Wed, 27 May 2015 12:50:04 -0700
Subject: [PATCH] gik cell z scale

---
 js/cells/GIKCell.js                 | 6 ++++++
 js/cells/supercells/GIKSuperCell.js | 6 +++---
 js/lattice/GIKLattice.js            | 1 +
 js/threeViews/Highlighter.js        | 5 ++++-
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/js/cells/GIKCell.js b/js/cells/GIKCell.js
index 7aacaa64..ac5d263e 100644
--- a/js/cells/GIKCell.js
+++ b/js/cells/GIKCell.js
@@ -5,6 +5,8 @@
 
 (function () {
 
+    var unitCellGeo = new THREE.BoxGeometry(1,1,1.28);
+
     function GIKCell(indices){
         this.indices = indices;
     }
@@ -18,6 +20,10 @@
         return this.object3D;
     };
 
+    GIKCell.prototype._getGeometry = function(){
+        return unitCellGeo;
+    };
+
     GIKCell.prototype._translateCell = function(object3D){
         if (this.superCellIndex) object3D.position.set(-this.superCellIndex*this.xScale(),0, 0);
         return object3D;
diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js
index dda8c5f2..d211c39f 100644
--- a/js/cells/supercells/GIKSuperCell.js
+++ b/js/cells/supercells/GIKSuperCell.js
@@ -15,7 +15,7 @@ GIKSuperCell = function(length, range, cells){
     this._addChildren(this._buildMesh(length), this.object3D);
     var self = this;
     _.each(cells, function(cell, index){
-        self.addObject3D(cell.setSuperCell(self, index));
+        self.addChildCell(cell.setSuperCell(self, index));
     });
     if (this.indices) globals.three.sceneAdd(this.object3D, "supercell");
 
@@ -27,7 +27,7 @@ GIKSuperCell.prototype._buildObject3D = function(){
     return this._translateCell(this._rotateCell(new THREE.Object3D()));
 };
 
-GIKSuperCell.prototype.addObject3D = function(object3D){
+GIKSuperCell.prototype.addChildCell = function(object3D){
     this._addChildren(object3D);
 };
 
@@ -38,7 +38,7 @@ GIKSuperCell.prototype._rotateCell = function(object3D){
 
 GIKSuperCell.prototype._buildMesh = function(length){
     var meshes = [];
-    var superCellGeo = new THREE.BoxGeometry(1,1,1);
+    var superCellGeo = new THREE.BoxGeometry(1,1,1.28);
     superCellGeo.applyMatrix(new THREE.Matrix4().makeScale(length, 1, 1));
     superCellGeo.applyMatrix(new THREE.Matrix4().makeTranslation(-length/2+0.5, 0, 0));
     var mesh = new THREE.Mesh(superCellGeo, this.getMaterialType());
diff --git a/js/lattice/GIKLattice.js b/js/lattice/GIKLattice.js
index 1cc3e3d8..f796133d 100644
--- a/js/lattice/GIKLattice.js
+++ b/js/lattice/GIKLattice.js
@@ -9,6 +9,7 @@ latticeSubclasses["GIKLattice"] = {
         _initLatticeType: function(){
             globals.basePlane = new SquareBasePlane();
             globals.highlighter = new GIKHighlighter();
+            globals.highlighter.updateGikLength();
         },
 
         getIndexForPosition: function(absPosition){
diff --git a/js/threeViews/Highlighter.js b/js/threeViews/Highlighter.js
index 76cba575..3948934f 100644
--- a/js/threeViews/Highlighter.js
+++ b/js/threeViews/Highlighter.js
@@ -206,7 +206,7 @@ CubeHighlighter = Highlighter.extend({
 GIKHighlighter = Highlighter.extend({
 
     _makeGeometry: function(){
-        return new THREE.BoxGeometry(1,1,1);
+        return new THREE.BoxGeometry(1,1,1);//globals.lattice.zScale(0)
     },
 
     _setPosition: function(position, direction){
@@ -221,6 +221,9 @@ GIKHighlighter = Highlighter.extend({
     },
 
     updateGikLength: function(){
+        if (!this.mesh) return;
+        this.mesh.scale.set(globals.lattice.get("gikLength"), 1, 1);
+        globals.three.render();
         if (!this.direction) return;
         this._setPosition(this.position, this.direction);//position of center point
         this._setRotation(this.direction, this.index);
-- 
GitLab