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

toggle highlight mode

parent 17e5725e
Branches
No related tags found
No related merge requests found
assets/imgs/cursor-light.png

3.13 KiB

......@@ -250,7 +250,7 @@ input.numberInput{
#navRibbon{
height: 49px;
width: 300px;
width: 320px;
z-index: 1;
display: block;
position: absolute;
......
......@@ -14,6 +14,10 @@ OneBitBot.prototype.setMachinePosition = function(){
_.each(_.values(this.meshes), function(mesh){//todo add cell?
mesh.position.set(self.position.x, self.position.y, self.position.z);
});
var stockPosition = dmaGlobals.assembler.get("stockPosition");
this.cell.moveTo(stockPosition.x, "x");
this.cell.moveTo(stockPosition.y, "y");
this.cell.moveTo(stockPosition.z, "z");
dmaGlobals.three.render();
};
......
......@@ -9,7 +9,8 @@ Ribbon = Backbone.View.extend({
events: {
"click .cellModeBtn": "_updateCellMode",
"click .deleteMode": "_updateDeleteMode"
"click .deleteMode": "_updateDeleteMode",
"click .highlightMode": "_updateHighlightMode"
},
initialize: function(){
......@@ -18,6 +19,7 @@ Ribbon = Backbone.View.extend({
this.listenTo(this.model, "change:cellMode", this.render);
this.listenTo(this.model, "change:deleteMode", this.render);
this.listenTo(this.model, "change:highlightMode", this.render);
this.listenTo(dmaGlobals.lattice, "change:cellType change:connectionType", this.render);
this.render();
},
......@@ -32,6 +34,11 @@ Ribbon = Backbone.View.extend({
dmaGlobals.appState.set("deleteMode", !dmaGlobals.appState.get("deleteMode"));
},
_updateHighlightMode: function(e){
e.preventDefault();
dmaGlobals.appState.set("highlightMode", !dmaGlobals.appState.get("highlightMode"));
},
render: function(){
this.$el.html(this.template(_.extend(dmaGlobals.lattice.toJSON(), this.model.toJSON())));
},
......@@ -43,6 +50,7 @@ Ribbon = Backbone.View.extend({
<% 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 class="btn btn-primary btn-ribbon highlightMode<% if (highlightMode){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/cursor-light.png"></a>\
<a class="btn btn-primary btn-ribbon deleteMode<% if (deleteMode){ %> ribbon-selected"<% } %>"><span class="fui-cross"></span></a>\
</div>\
</div>\
......
......@@ -135,6 +135,7 @@ AppState = Backbone.Model.extend({
//key bindings
shift: false,
deleteMode: false,
highlightMode: true,
extrudeMode: false,
cellMode: "cell",//show cells vs part
......
......@@ -86,6 +86,8 @@ ThreeView = Backbone.View.extend({
_mouseMoved: function(e){
if (!dmaGlobals.appState.get("highlightMode")) return;
if (this.mouseIsDown && !this.controls.noRotate) {//in the middle of a camera move
this.highlighter.setNothingHighlighted();
this._setNoPartIntersections();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment