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

add multiple gik blocks

parent a13f3b1f
No related branches found
No related tags found
No related merge requests found
...@@ -70,7 +70,7 @@ Highlighter = Backbone.View.extend({ ...@@ -70,7 +70,7 @@ Highlighter = Backbone.View.extend({
var highlightedPos = highlighted.myParent.calcHighlighterPosition(intersection.face, intersection.point); var highlightedPos = highlighted.myParent.calcHighlighterPosition(intersection.face, intersection.point);
this.index = highlightedPos.index; this.index = highlightedPos.index;
this.position = highlightedPos.position; this.position = highlightedPos.position;//todo used just for gik
if (!highlightedPos.direction) {//may be hovering over a face that we shouldn't highlight if (!highlightedPos.direction) {//may be hovering over a face that we shouldn't highlight
this.hide(); this.hide();
return; return;
...@@ -229,7 +229,7 @@ GIKHighlighter = Highlighter.extend({ ...@@ -229,7 +229,7 @@ GIKHighlighter = Highlighter.extend({
this.mesh.translateX(-this.mesh.scale.x/2+this.mesh.scale.z/2); this.mesh.translateX(-this.mesh.scale.x/2+this.mesh.scale.z/2);
} }
else { else {
this.mesh.rotation.set(0, 0,0); this.mesh.rotation.set(0,0,0);
this.mesh.translateX(-this.mesh.scale.x/2+this.mesh.scale.z/2); this.mesh.translateX(-this.mesh.scale.x/2+this.mesh.scale.z/2);
} }
}, },
...@@ -239,6 +239,24 @@ GIKHighlighter = Highlighter.extend({ ...@@ -239,6 +239,24 @@ GIKHighlighter = Highlighter.extend({
this._setPosition(this.position, this.direction);//position of center point this._setPosition(this.position, this.direction);//position of center point
this._setRotation(this.direction, this.index); this._setRotation(this.direction, this.index);
dmaGlobals.three.render(); dmaGlobals.three.render();
},
addRemoveVoxel: function(shouldAdd){
if (shouldAdd){
if (!this.isVisible() || !this.highlightedObject) return;
var position = this._getNextCellPosition();
var min;
if (this.mesh.rotation.z == 0) min = {x:position.x-(dmaGlobals.lattice.get("gikLength")-1), y:position.y, z:position.z};
else min = {x:position.x, y:position.y-(dmaGlobals.lattice.get("gikLength")-1), z:position.z};
var range = {min:min, max:position};
dmaGlobals.lattice.addCellsInRange(range);
} else {
if (!this.highlightedObject) return;
if (!(this.highlightedObject instanceof DMACell)) return;
dmaGlobals.lattice.removeCell(this.highlightedObject);
}
this.setNothingHighlighted();
} }
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment