From 750390240dadebc43f1025ed9087ab00ac881b8b Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Wed, 25 Mar 2015 01:14:58 -0400
Subject: [PATCH] manually select origin from cell

---
 js/threeViews/Highlighter.js | 5 +++++
 js/threeViews/ThreeView.js   | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/js/threeViews/Highlighter.js b/js/threeViews/Highlighter.js
index a5201a92..94f13021 100644
--- a/js/threeViews/Highlighter.js
+++ b/js/threeViews/Highlighter.js
@@ -84,6 +84,11 @@ Highlighter = Backbone.View.extend({
     /////////////////////////////POSITION/SCALE////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////////////////////
 
+    getHighlightedObjectPosition: function(){
+        if (this.highlightedObject instanceof DMACell) return this.highlightedObject.getPosition();
+        return null;
+    },
+
     updateScale: function(scale){
         this.mesh.scale.set(scale, scale, scale);
     },
diff --git a/js/threeViews/ThreeView.js b/js/threeViews/ThreeView.js
index e2d74f77..e3b732ff 100644
--- a/js/threeViews/ThreeView.js
+++ b/js/threeViews/ThreeView.js
@@ -68,6 +68,13 @@ ThreeView = Backbone.View.extend({
 
     _mouseUp: function(){
         this.mouseIsDown = false;
+        if (dmaGlobals.appState.get("currentTab") == "cam" && dmaGlobals.appState.get("manualSelectOrigin")){
+            var position = this.highlighter.getHighlightedObjectPosition();
+            if (position){
+                dmaGlobals.assembler.set("originPosition", position);
+                return;
+            }
+        }
         if (this.currentIntersectedPart) this.currentIntersectedPart.removeFromCell();
         else this.highlighter.addRemoveVoxel(!this.appState.get("deleteMode"));
     },
-- 
GitLab