Skip to content
Snippets Groups Projects
Commit 5b72e594 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

default gik length

parent 426896a6
Branches
No related tags found
No related merge requests found
......@@ -84,9 +84,12 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu
function setMaterialDefaults(){
var materialType = appState.get("materialType");
if (!materials[materialType].dimensions) return;
appState.set("superCellRange", materials[materialType].dimensions.clone());
appState.set("superCellIndex", new THREE.Vector3(0,0,0));
if (materials[materialType].dimensions){
appState.set("superCellRange", materials[materialType].dimensions.clone());
} else if (lattice.get("connectionType") == "gik"){
appState.set("superCellRange", new THREE.Vector3(appState.get("gikLength"), 1, 1));
}
}
return materials;
......
......@@ -17,7 +17,7 @@ Cell Connection:  
</ul>
</div><br/><br/>
<% if (connectionType == "gik") { %>
GIK Length:&nbsp;&nbsp;<input data-property="superCellRange" data-key="x" value="<%= superCellRange.x %>" placeholder="GIK length" class="form-control intInput appState" type="text"><br/><br/>
GIK Length:&nbsp;&nbsp;<input data-property="gikLength" value="<%= gikLength %>" placeholder="GIK length" class="form-control intInput appState" type="text"><br/><br/>
<% } %>
<a href="#" class="clearCells btn btn-block btn-lg btn-danger">Clear All Cells</a><br/>
Num Cells:&nbsp;&nbsp;<%= numCells %><br/>
......
......@@ -34,6 +34,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
cellsVisible: true,
superCellIndex: new THREE.Vector3(0,0,0),//offset of superCell adds
gikLength: 4,//this updates super cell range when using non-composite materials
superCellRange: new THREE.Vector3(1,1,1),
realisticColorScheme: false,
......@@ -58,6 +59,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
this.listenTo(this, "change:currentTab", this._tabChanged);
this.listenTo(this, "change:currentNav", this._navChanged);
this.listenTo(this, "change:materialType", this._materialTypeChanged);
this.listenTo(this, "change:gikLength", this._gikLengthChanged);
this.downKeys = {};//track keypresses to prevent repeat keystrokeson hold
......@@ -125,6 +127,12 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
});
},
_gikLengthChanged: function(){
if (this.get("materialType").substr(0,5) != "super"){
this.set("superCellRange", new THREE.Vector3(this.get("gikLength"), 1, 1));
}
},
///////////////////////////////////////////////////////////////////////////////
/////////////////////KEY BINDINGS//////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
......@@ -200,9 +208,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
case 57:
if (this.lattice.get("connectionType") != "gik") break;
if (state) {
var range = this.get("superCellRange").clone();
range.x = e.keyCode-48;
this.set("superCellRange", range);
this.set("gikLength", e.keyCode-48);
}
break;
case 87://w - increase supercell index
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment