Commit 9a17158e authored by Amanda Ghassaei's avatar Amanda Ghassaei

odds and ends

parent 8892b5f6
......@@ -15,6 +15,10 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'],
return null;//never show the gik cell
};
GIKCell.prototype.getLength = function(){
return this.superCell.getLength();
};
GIKCell.prototype._initParts = function(callback){
if (!this.superCell) return;
var self = this;
......@@ -57,7 +61,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'],
isBridge: false
}));
}
parts.push(new PartSubclass(self.index.x, self, {isBridge: true}));
if (self.getLength() > 1) parts.push(new PartSubclass(self.index.x, self, {isBridge: true}));
callback(parts);
});
}
......
......@@ -25,15 +25,17 @@ Type:  
<% }); %>
</ul>
</div><br/><br/>
Part Type: &nbsp;&nbsp;
<div class="btn-group">
<button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allLattices[cellType].connection[connectionType].type[latticeType].parts[partType].name %><span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<% _.each(allLattices[cellType].connection[connectionType].type[latticeType].parts, function(val, key){ %>
<li><a class="lattice dropdownSelector" data-property="partType" data-value="<%= key %>" href="#"><%= val.name %></a></li>
<% }); %>
</ul>
</div><br/><br/>
<% if(allLattices[cellType].connection[connectionType].type[latticeType].parts){ %>
Part Type: &nbsp;&nbsp;
<div class="btn-group">
<button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allLattices[cellType].connection[connectionType].type[latticeType].parts[partType].name %><span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<% _.each(allLattices[cellType].connection[connectionType].type[latticeType].parts, function(val, key){ %>
<li><a class="lattice dropdownSelector" data-property="partType" data-value="<%= key %>" href="#"><%= val.name %></a></li>
<% }); %>
</ul>
</div><br/><br/>
<% } %>
Aspect Ratio:&nbsp;&nbsp;
<input data-property="aspectRatio" data-key="x" value="<%= aspectRatio.x %>" placeholder="X" class="form-control lattice floatInput" type="text">&nbsp;
<input data-property="aspectRatio" data-key="y" value="<%= aspectRatio.y %>" placeholder="Y" class="form-control lattice floatInput" type="text">&nbsp;
......
......@@ -199,7 +199,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
} else this.downKeys[e.keyCode] = false;
// console.log(e);
// console.log(e.keyCode);
console.log(e.keyCode);
switch(e.keyCode){
case 8://delete key - causes back nav in chrome, super annoying
e.preventDefault();
......@@ -250,7 +250,8 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
e.preventDefault();
if (state && this.get("currentTab") == "animate") this.set("stockSimulationPlaying", !this.get("stockSimulationPlaying"));
break;
case 50://2-9
case 49://1-9
case 50:
case 51:
case 52:
case 53:
......@@ -260,7 +261,15 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
case 57:
if (this.lattice.get("connectionType") != "gik") break;
if (state) {
this.set("gikLength", e.keyCode-48);
var val = e.keyCode-48;
var range = plist.allLattices[this.lattice.get("cellType")].connection[this.lattice.get("connectionType")].type[this.lattice.get("latticeType")].options.gikRange;
if (range){
if ((range[0] > 0 && val < range[0]) || (range[1] > 1 && val > range[1])){
console.warn("gik length out of range");
return;
}
}
this.set("gikLength", val);
}
break;
case 87://w - increase supercell index
......
......@@ -41,7 +41,7 @@ define(['underscore', 'stlLoader', 'part', 'bin!gikPartSTL', 'bin!gikEndPartSTL'
};
GIKPart.prototype._getGIKLength = function(){
return this.parentCell.superCell.getLength();
return this.parentCell.getLength();
};
return GIKPart;
......
......@@ -234,7 +234,9 @@ define(['three'], function(THREE){
aspectRatio: new THREE.Vector3(1,1,1.28),
materialClasses: ['electronic'],
options: {
gikLength: 4
gikLength: 4,
gikRange: [1,-1],
units: "mm"
}
},
lego: {
......@@ -265,6 +267,7 @@ define(['three'], function(THREE){
materialClasses: ['dna'],
options: {
gikLength: 2,
gikRange: [1,2],
scale: 2.5,
units: 'nm'
}
......@@ -272,7 +275,8 @@ define(['three'], function(THREE){
default: {
name: "Default",
parts: null,
aspectRatio: new THREE.Vector3(1,1,1)
aspectRatio: new THREE.Vector3(1,1,1),
options:{}
}
}
}
......
Markdown is supported
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