repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 0b2911c88fae6dc4c7888b91fbc337466e0741aa:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 0b2911c88fae6dc4c7888b91fbc337466e0741aa
Author: James Baicoianu 
Date:   Sat Oct 31 10:28:07 2020 -0700

    Implement tracked pointer mousemove, pass input object through with event

diff --git a/scripts/janusxrplayer.js b/scripts/janusxrplayer.js
index b6f9fcc7b4fa92446ad7c141b46745a2950185cd..
index ..137f5e775ddd1ef96d306ebe6034fbd38ad2f9c9 100644
--- a/scripts/janusxrplayer.js
+++ b/scripts/janusxrplayer.js
@@ -574,14 +574,16 @@ elation.require(['engine.things.generic', 'janusweb.external.webxr-input-profile

         this.updateLaserEndpoint(ev.data.intersection.point);

+        this.lasthit = ev.data.intersection;
         let evdata = {
           type: "mouseover",
           element: ev.data.intersection.mesh,
           relatedTarget: oldactiveobject,
-          data: ev.data.intersection,
+          data: this.lasthit,
           clientX: 0, // FIXME - can we project back to the screen x,y from the intersection point?
           clientY: 0,
           bubbles: true,
+          inputSourceObject: this.hand,
         };
         if (this.hand) {
           evdata.data.gamepad = this.hand.device.gamepad;
@@ -591,6 +593,22 @@ elation.require(['engine.things.generic', 'janusweb.external.webxr-input-profile
       },
       handleRaycastMove(ev) {
         this.updateLaserEndpoint(ev.data.intersection.point);
+        if (this.activeobject) {
+          let obj = this.activeobject.objects['3d'];
+          this.lasthit = ev.data.intersection;
+
+          this.engine.client.view.proxyEvent({
+            type: "mousemove",
+            element: obj,
+            data: this.lasthit,
+            //data: ev.data.intersection, // FIXME - need to store intersection data from raycastmove
+            clientX: 0, // FIXME - can we project back to the screen x,y from the intersection point?
+            clientY: 0,
+            button: 0,
+            bubbles: true,
+            inputSourceObject: this.hand,
+          }, obj);
+        }
       },
       handleRaycastLeave(ev) {
         this.laser.col.setRGB(0,1,1);
@@ -604,10 +622,12 @@ elation.require(['engine.things.generic', 'janusweb.external.webxr-input-profile
             type: "mousedown",
             element: obj,
             //data: ev.data.intersection, // FIXME - need to store intersection data from raycastmove
+            data: this.lasthit,
             clientX: 0, // FIXME - can we project back to the screen x,y from the intersection point?
             clientY: 0,
             button: 0,
             bubbles: true,
+            inputSourceObject: this.hand,
           }, obj);
         }
       },
@@ -615,13 +635,15 @@ elation.require(['engine.things.generic', 'janusweb.external.webxr-input-profile
         if (this.activeobject) {
           let obj = this.activeobject.objects['3d'];
           this.engine.client.view.proxyEvent({
-            type: "mousemove",
+            type: "mouseup",
             element: obj,
             //data: ev.data.intersection, // FIXME - need to store intersection data from raycastmove
+            data: this.lasthit,
             clientX: 0, // FIXME - can we project back to the screen x,y from the intersection point?
             clientY: 0,
             button: 0,
             bubbles: true,
+            inputSourceObject: this.hand,
           }, obj);
         }
       },
@@ -633,10 +655,12 @@ elation.require(['engine.things.generic', 'janusweb.external.webxr-input-profile
             type: "click",
             element: obj,
             //data: ev.data.intersection, // FIXME - need to store intersection data from raycastmove
+            data: this.lasthit,
             clientX: 0, // FIXME - can we project back to the screen x,y from the intersection point?
             clientY: 0,
             button: 0,
             bubbles: true,
+            inputSourceObject: this.hand,
           }, obj);
         }
       },

-----END OF PAGE-----