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

script menu

parent f18dc6d4
No related branches found
No related tags found
No related merge requests found
......@@ -21,8 +21,7 @@ MenuWrapper = Backbone.View.extend({
var lattice = globals.lattice;
//init all tab view controllers
this.sketchMenu = new SketchMenuView({model:lattice, appState:this.model});
this.scriptMenu = new ScriptMenuView({model:this.model});
this.physicsMenu = new PhysicsMenuView({model:this.model});
this.materialMenu = new MaterialMenuView({model:this.model});
this.optimizeMenu = new OptimizationMenuView({model:this.model});
......@@ -133,11 +132,13 @@ MenuWrapper = Backbone.View.extend({
if (!this.importMenu) this.importMenu = new ImportMenuView({model:this.model});
this.importMenu.render();
} else if (tabName == "sketch"){
if (!this.sketchMenu) this.sketchMenu = new SketchMenuView({model:this.model});
this.sketchMenu.render();
} else if (tabName == "part"){
if (!this.partMenu) this.partMenu = new PartMenuView({model:this.model});
this.partMenu.render();
} else if (tabName == "script"){
if (!this.scriptMenu) this.scriptMenu = new ScriptMenuView({model:this.model});
this.scriptMenu.render();
} else if (tabName == "physics"){
this.physicsMenu.render();
......
......@@ -9,7 +9,7 @@ ScriptMenuView = Backbone.View.extend({
events: {
},
initialize: function(options){
initialize: function(){
_.bindAll(this, "render");
},
......@@ -17,7 +17,7 @@ ScriptMenuView = Backbone.View.extend({
render: function(){
if (this.model.changedAttributes()["currentNav"]) return;
if (this.model.get("currentTab") != "script") return;
this.$el.html(this.template(this.model.toJSON()));
this.$el.html(this.template(globals.plist));
},
template: _.template('\
......@@ -25,11 +25,11 @@ ScriptMenuView = Backbone.View.extend({
<button data-toggle="dropdown" class="btn btn-default btn-lg dropdown-toggle fullWidth" type="button">Load Script<span class="caret"></span></button>\
<ul role="menu" class="dropdown-menu">\
<% _.each(_.keys(allScripts), function(key){ %>\
<li><a class="units" data-type="<%= key %>" href="#"><%= allScripts[key] %></a></li>\
<li><a data-type="<%= key %>" href="#"><%= allScripts[key] %></a></li>\
<% }); %>\
</ul>\
</div><br/><br/><!-- /btn-group -->\
<a href="#" id="scriptClearCells" class=" btn btn-block btn-lg btn-default">Clear All Cells</a><br/>\
<a href="#" class="clearCells btn btn-block btn-lg btn-default">Clear All Cells</a><br/>\
')
});
\ No newline at end of file
......@@ -11,22 +11,20 @@ SketchMenuView = Backbone.View.extend({
"slide #zHeightSlider": "_moveSketchPlane"
},
initialize: function(options){
this.appState = options.appState;
initialize: function(){
_.bindAll(this, "render");
},
_moveSketchPlane: function(e){
this.model.get("basePlane").set("zIndex", $(e.target).val());
globals.basePlane.set("zIndex", $(e.target).val());
},
render: function(){
if (this.model.changedAttributes()["currentNav"]) return;
if (this.appState.get("currentTab") != "sketch") return;
this.$el.html(this.template(this.model.get("basePlane").toJSON()));
if (this.model.get("currentTab") != "sketch") return;
this.$el.html(this.template(globals.basePlane.toJSON()));
$('#zHeightSlider').slider({
formatter: function(value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment