From 4717449b6ea20e1953336e5e853d0d2ed71d4a3b Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Sun, 25 Jan 2015 17:16:01 -0500
Subject: [PATCH] shift drag to madd many cells at once

---
 js/threeViews/threeView.js | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/js/threeViews/threeView.js b/js/threeViews/threeView.js
index 6c8df363..bdb24588 100644
--- a/js/threeViews/threeView.js
+++ b/js/threeViews/threeView.js
@@ -68,6 +68,7 @@ ThreeView = Backbone.View.extend({
         switch(e.keyCode){
             case 16://shift
                 this.shiftIsDown = state;
+                this.controls.enabled = !state;
                 break;
             default:
         }
@@ -75,10 +76,7 @@ ThreeView = Backbone.View.extend({
 
     _mouseUp: function(){
         this.mouseIsDown = false;
-
-        if (!this.highlighter.visible) return;
-
-        this.lattice.addCell(this.highlighter.geometry.vertices[0]);
+        this._addVoxel();
     },
 
     _mouseDown: function(){
@@ -87,7 +85,7 @@ ThreeView = Backbone.View.extend({
 
     _mouseMoved: function(e){
 
-        if (this.mouseIsDown) {//in the middle of a camera move
+        if (this.mouseIsDown && !this.shiftIsDown) {//in the middle of a camera move
             this._hideHighlighter();
             return;
         }
@@ -128,9 +126,17 @@ ThreeView = Backbone.View.extend({
             (new THREE.Vector3()).addVectors(vertices[intersection.b], position), (new THREE.Vector3()).addVectors(vertices[intersection.c], position)];
         this.highlighter.geometry.verticesNeedUpdate = true;
 
+        if (this.mouseIsDown && this.shiftIsDown) this._addVoxel();
+
         window.three.render();
     },
 
+    _addVoxel: function(){
+        if (!this.highlighter.visible) return;
+        this.lattice.addCell(this.highlighter.geometry.vertices[0]);
+        this._hideHighlighter();
+    },
+
     _hideHighlighter: function(){
         if (this.highlighter.visible){
             this.highlighter.visible = false;
-- 
GitLab