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

highlighter feel is better

parent 5ebaec4d
No related branches found
No related tags found
No related merge requests found
...@@ -88,18 +88,17 @@ ThreeView = Backbone.View.extend({ ...@@ -88,18 +88,17 @@ ThreeView = Backbone.View.extend({
var vector = new THREE.Vector2(2*(e.pageX-this.$el.offset().left)/this.$el.width()-1, 1-2*(e.pageY-this.$el.offset().top)/this.$el.height()); var vector = new THREE.Vector2(2*(e.pageX-this.$el.offset().left)/this.$el.width()-1, 1-2*(e.pageY-this.$el.offset().top)/this.$el.height());
this.mouseProjection.setFromCamera(vector, this.model.camera); this.mouseProjection.setFromCamera(vector, this.model.camera);
//check if we're in the same spot var objsToIntersect = this.model.cells.concat(this.model.basePlane);
if (this.highlighter.isVisible()){ if (this.highlighter.isVisible()) objsToIntersect = objsToIntersect.concat(this.highlighter.mesh);
if(this.mouseProjection.intersectObject(this.highlighter.mesh, false).length > 0) return; var intersections = this.mouseProjection.intersectObjects(objsToIntersect, false);
}
var intersections = this.mouseProjection.intersectObjects(this.model.cells.concat(this.model.basePlane), false);
if (intersections.length == 0) {//no intersections if (intersections.length == 0) {//no intersections
this.highlighter.setNothingHighlighted(); this.highlighter.setNothingHighlighted();
this._setNoPartIntersections(); this._setNoPartIntersections();
return; return;
} }
if(intersections[0].object == this.highlighter.mesh) return;
this.highlighter.highlight(intersections[0]); this.highlighter.highlight(intersections[0]);
if (this.mouseIsDown) { if (this.mouseIsDown) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment