From ebfdefd261d35de7997b4048578b6d7df2a1b430 Mon Sep 17 00:00:00 2001
From: johnshaughnessy <johnfshaughnessy@gmail.com>
Date: Fri, 2 Nov 2018 17:20:17 -0700
Subject: [PATCH] Don't let camera drag mouse when holding something

---
 src/systems/userinput/devices/app-aware-mouse.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/systems/userinput/devices/app-aware-mouse.js b/src/systems/userinput/devices/app-aware-mouse.js
index 66e006d44..de5f4acec 100644
--- a/src/systems/userinput/devices/app-aware-mouse.js
+++ b/src/systems/userinput/devices/app-aware-mouse.js
@@ -1,3 +1,4 @@
+import { sets } from "../sets";
 import { paths } from "../paths";
 import { Pose } from "../pose";
 
@@ -35,9 +36,13 @@ export class AppAwareMouseDevice {
       const rawIntersections = [];
       this.cursorController.raycaster.intersectObjects(this.cursorController.targets, true, rawIntersections);
       const intersection = rawIntersections.find(x => x.object.el);
+      const userinput = AFRAME.scenes[0].systems.userinput;
       this.clickedOnAnything =
-        intersection &&
-        intersection.object.el.matches(".pen, .pen *, .video, .video *, .interactable, .interactable *");
+        (intersection &&
+          intersection.object.el.matches(".pen, .pen *, .video, .video *, .interactable, .interactable *")) ||
+        userinput.activeSets.has(sets.cursorHoldingPen) ||
+        userinput.activeSets.has(sets.cursorHoldingInteractable) ||
+        userinput.activeSets.has(sets.cursorHoldingCamera);
     }
     this.prevButtonLeft = buttonLeft;
 
-- 
GitLab