From c7bc2a98617d2578eca65f7921f9a4cb82112097 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Fri, 15 May 2015 22:19:40 -0400
Subject: [PATCH] material type dropdown

---
 js/menus/PartMenuView.js     | 13 ++++++++++++-
 js/models/Lattice.js         |  1 +
 js/threeViews/Highlighter.js |  2 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/js/menus/PartMenuView.js b/js/menus/PartMenuView.js
index 10f9343e..0798d269 100644
--- a/js/menus/PartMenuView.js
+++ b/js/menus/PartMenuView.js
@@ -67,7 +67,18 @@ PartMenuView = Backbone.View.extend({
         Cell Separation <% if (connectionType != "freeformFace"){ %>(xy, z): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text">\
         &nbsp;<input data-type="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control numberInput cellSeparation" type="text">\
         <% } else { %>( radial ): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text"><% } %>\
-        <br/><br/>todo: generic beam part type, part types for new lattice configurations\
+        <br/><br/>\
+        <% if (allMaterialTypes[cellType][connectionType]){ %> \
+        Material Type: &nbsp;&nbsp;\<div class="btn-group">\
+                <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allMaterialTypes[cellType][connectionType][materialType] %><span class="caret"></span></button>\
+                <ul role="menu" class="dropdown-menu">\
+                    <% _.each(_.keys(allMaterialTypes[cellType][connectionType]), function(key){ %>\
+                        <li><a class="partType" data-type="<%= key %>" href="#"><%= allMaterialTypes[cellType][connectionType][key] %></a></li>\
+                    <% }); %>\
+                </ul>\
+            </div><br/><br/>\
+        <% } %>\
+        <br/>todo: generic beam part type, part types for new lattice configurations\
         ')
 
 });
\ No newline at end of file
diff --git a/js/models/Lattice.js b/js/models/Lattice.js
index 9219e32c..c7ff0c7d 100644
--- a/js/models/Lattice.js
+++ b/js/models/Lattice.js
@@ -25,6 +25,7 @@ Lattice = Backbone.Model.extend({
         cellType: "cube",
         connectionType: "gik",
         partType: "lego",
+        materialType: "fiberGlass",
         gikLength: 4
     },
 
diff --git a/js/threeViews/Highlighter.js b/js/threeViews/Highlighter.js
index 7be8ae3f..c0cb204f 100644
--- a/js/threeViews/Highlighter.js
+++ b/js/threeViews/Highlighter.js
@@ -220,7 +220,7 @@ GIKHighlighter = Highlighter.extend({
 
     _setPosition: function(position, direction){
         var scale = this.mesh.scale.z/2;
-        this.mesh.position.set(position.x+scale*direction.x, position.y+scale*direction.y, position.z+scale*direction.z);
+        this.mesh.position.set(position.x+scale*direction.x, position.y+scale*direction.y, position.z+dmaGlobals.lattice.zScale()/2*direction.z);
     },
 
     _setRotation: function(direction, index){
-- 
GitLab