diff --git a/index.html b/index.html index 59fdde427935ca27262e428e686998a03b19af0d..b95679583cfc2304a489154f93b57f5907251456 100644 --- a/index.html +++ b/index.html @@ -141,8 +141,10 @@ <li><a href="#">Console</a></li> <li class="divider"></li> <li><a href="#">Ambient Occlusion</a></li> - <li class="divider"></li> + <li><a href="#">Realistic Material Colors</a></li> <li><a href="#">BasePlane</a></li> + <li><a href="#">Hover Tool</a></li> + <li class="divider"></li> <li><a href="#">Reset 3D Navigation</a></li> </ul> </li> diff --git a/js/menus/MenuWrapperView.js b/js/menus/MenuWrapperView.js index f96bad6b9295e0bd881714ad514bd0aaedf726cb..8333af1f9a2320fdddd47338bf408ceb6de4ab35 100644 --- a/js/menus/MenuWrapperView.js +++ b/js/menus/MenuWrapperView.js @@ -21,22 +21,15 @@ MenuWrapper = Backbone.View.extend({ _.bindAll(this, "render", "_updateCurrentTab", "_setVisibility", "_hide", "_show", "_onKeyUp"); $(document).bind('keyup', {}, this._onKeyUp); - var lattice = globals.lattice; - - //init all tab view controllers - this.animationMenu = new AnimationMenuView({model:this.model}); - this.sendMenu = new SendMenuView({model:this.model}); - //bind events this.listenTo(this.model, "change:currentNav", this.render); - this.listenTo(lattice, "change:cellType change:connectionType", this._populateAndShow); + this.listenTo(globals.lattice, "change:cellType change:connectionType", this._populateAndShow); this.listenTo(this.model, "change:currentTab", this._updateCurrentTab); this.listenTo(this.model, "change:menuIsVisible", this._setVisibility); if (this.model.get("menuIsVisible")) this._populateAndShow(); }, - _onKeyUp: function(e){ if ($("input").is(":focus") && e.keyCode == 13) {//enter key $(e.target).blur(); @@ -78,6 +71,7 @@ MenuWrapper = Backbone.View.extend({ } var key = $target.data("key"); + //some numbers are relative if (property == "stockPosition" && globals.assembler.get(property + "Relative")){ if (key) newVal = parseFloat((newVal + globals.assembler.get("originPosition")[key]).toFixed(4)); else console.warn("no key found for " + property); @@ -145,7 +139,6 @@ MenuWrapper = Backbone.View.extend({ $tab.removeClass("active"); } }); - this._renderTab(tabName); }, @@ -183,8 +176,10 @@ MenuWrapper = Backbone.View.extend({ if (!this.camMenu) this.camMenu = new CamMenuView({model:this.model}); this.camMenu.render(); } else if (tabName == "animate"){ + if (!this.animationMenu) this.animationMenu = new AnimationMenuView({model:this.model}); this.animationMenu.render(); } else if (tabName == "send"){ + if (!this.sendMenu) this.sendMenu = new SendMenuView({model:this.model}); this.sendMenu.render(); } else { console.warn("no tab initialized!"); @@ -196,7 +191,7 @@ MenuWrapper = Backbone.View.extend({ var self = this; this._hide(function(){ self._populateAndShow(); - self.model.trigger("change:currentTab");//this was updated silently before + self.model.trigger("change:currentTab");//this was updated silently before todo need this? }, true); }, diff --git a/js/menus/Ribbon.js b/js/menus/Ribbon.js index 9e1ea57dc71cf62191e188bde8085ffde18c0509..0fe3524212a3e4074e379d27034d42b8a2402aee 100644 --- a/js/menus/Ribbon.js +++ b/js/menus/Ribbon.js @@ -8,8 +8,8 @@ Ribbon = Backbone.View.extend({ el: "#navRibbon", events: { - "click .cellModeBtn": "_updateCellMode", - "click .deleteMode": "_updateDeleteMode", + "click .ribbonCellMode": "_updateCellMode", + "click .ribbonDeleteMode": "_updateDeleteMode", "click .highlightMode": "_updateHighlightMode", "click .cellsVisible": "_updateVisibility" }, @@ -53,11 +53,11 @@ Ribbon = Backbone.View.extend({ template: _.template('\ <div class="btn-toolbar">\ <div class="btn-group">\ - <a data-type="cell" class="btn btn-primary btn-ribbon cellModeBtn<% if (cellMode == "cell"){ %> ribbon-selected<% } %>" href="#"><img data-type="cell" src="assets/imgs/cell-sm.png"></a>\ + <a data-type="cell" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "cell"){ %> ribbon-selected<% } %>" href="#"><img data-type="cell" src="assets/imgs/cell-sm.png"></a>\ <% if (allPartTypes[cellType][connectionType]){ %>\ - <a data-type="part" class="btn btn-primary btn-ribbon cellModeBtn<% if (cellMode == "part"){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/part-sm.png"></a>\ + <a data-type="part" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "part"){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/part-sm.png"></a>\ <% } %>\ - <a class="btn btn-primary btn-ribbon deleteMode<% if (deleteMode){ %> ribbon-selected"<% } %>"><span class="fui-cross"></span></a>\ + <a class="btn btn-primary btn-ribbon ribbonDeleteMode<% if (deleteMode){ %> ribbon-selected"<% } %>"><span class="fui-cross"></span></a>\ </div>\ </div>\ ') diff --git a/js/models/Lattice.js b/js/models/Lattice.js index 6f023b64585ad2829da221a6a6e7f49d69a590f0..ae85ba65e5caab46275068593557d50150d04403 100644 --- a/js/models/Lattice.js +++ b/js/models/Lattice.js @@ -20,9 +20,9 @@ Lattice = Backbone.Model.extend({ //spacing for connectors/joints cellSeparation: {xy:0, z:0}, - cellType: "cube", - connectionType: "gik", - partType: "lego", + cellType: "octa", + connectionType: "edgeRot", + partType: "vox", materialType: "fiberGlass", gikLength: 4 },