Przeglądaj źródła

Adding additionalData member to ActionEvent

David catuhe 10 lat temu
rodzic
commit
15ce8fe271

Plik diff jest za duży
+ 881 - 880
dist/preview release - alpha/babylon.2.2.d.ts


Plik diff jest za duży
+ 5 - 4
dist/preview release - alpha/babylon.2.2.js


+ 6 - 5
dist/preview release - alpha/babylon.2.2.max.js

@@ -13629,7 +13629,7 @@ var BABYLON;
                         var currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);
                         if (areIntersecting && currentIntersectionInProgress === -1) {
                             if (action.trigger === BABYLON.ActionManager.OnIntersectionEnterTrigger) {
-                                action._executeCurrent(BABYLON.ActionEvent.CreateNew(sourceMesh));
+                                action._executeCurrent(BABYLON.ActionEvent.CreateNew(sourceMesh, null, otherMesh));
                                 sourceMesh._intersectionsInProgress.push(otherMesh);
                             }
                             else if (action.trigger === BABYLON.ActionManager.OnIntersectionExitTrigger) {
@@ -13640,7 +13640,7 @@ var BABYLON;
                             //They intersected, and now they don't.
                             //is this trigger an exit trigger? execute an event.
                             if (action.trigger === BABYLON.ActionManager.OnIntersectionExitTrigger) {
-                                action._executeCurrent(BABYLON.ActionEvent.CreateNew(sourceMesh));
+                                action._executeCurrent(BABYLON.ActionEvent.CreateNew(sourceMesh, null, otherMesh));
                             }
                             //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.
                             if (!sourceMesh.actionManager.hasSpecificTrigger(BABYLON.ActionManager.OnIntersectionExitTrigger) || action.trigger === BABYLON.ActionManager.OnIntersectionExitTrigger) {
@@ -28055,21 +28055,22 @@ var BABYLON;
          * @param meshUnderPointer The mesh that is currently pointed at (can be null)
          * @param sourceEvent the original (browser) event that triggered the ActionEvent
          */
-        function ActionEvent(source, pointerX, pointerY, meshUnderPointer, sourceEvent) {
+        function ActionEvent(source, pointerX, pointerY, meshUnderPointer, sourceEvent, additionalData) {
             this.source = source;
             this.pointerX = pointerX;
             this.pointerY = pointerY;
             this.meshUnderPointer = meshUnderPointer;
             this.sourceEvent = sourceEvent;
+            this.additionalData = additionalData;
         }
         /**
          * Helper function to auto-create an ActionEvent from a source mesh.
          * @param source the source mesh that triggered the event
          * @param evt {Event} The original (browser) event
          */
-        ActionEvent.CreateNew = function (source, evt) {
+        ActionEvent.CreateNew = function (source, evt, additionalData) {
             var scene = source.getScene();
-            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
+            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
         };
         /**
          * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew

Plik diff jest za duży
+ 5 - 4
dist/preview release - alpha/babylon.2.2.noworker.js


+ 4 - 3
src/Actions/babylon.actionManager.js

@@ -12,21 +12,22 @@ var BABYLON;
          * @param meshUnderPointer The mesh that is currently pointed at (can be null)
          * @param sourceEvent the original (browser) event that triggered the ActionEvent
          */
-        function ActionEvent(source, pointerX, pointerY, meshUnderPointer, sourceEvent) {
+        function ActionEvent(source, pointerX, pointerY, meshUnderPointer, sourceEvent, additionalData) {
             this.source = source;
             this.pointerX = pointerX;
             this.pointerY = pointerY;
             this.meshUnderPointer = meshUnderPointer;
             this.sourceEvent = sourceEvent;
+            this.additionalData = additionalData;
         }
         /**
          * Helper function to auto-create an ActionEvent from a source mesh.
          * @param source the source mesh that triggered the event
          * @param evt {Event} The original (browser) event
          */
-        ActionEvent.CreateNew = function (source, evt) {
+        ActionEvent.CreateNew = function (source, evt, additionalData) {
             var scene = source.getScene();
-            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
+            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
         };
         /**
          * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew

+ 3 - 3
src/Actions/babylon.actionManager.ts

@@ -12,7 +12,7 @@
          * @param meshUnderPointer The mesh that is currently pointed at (can be null)
          * @param sourceEvent the original (browser) event that triggered the ActionEvent
          */
-        constructor(public source: AbstractMesh, public pointerX: number, public pointerY: number, public meshUnderPointer: AbstractMesh, public sourceEvent?: any) {
+        constructor(public source: AbstractMesh, public pointerX: number, public pointerY: number, public meshUnderPointer: AbstractMesh, public sourceEvent?: any, public additionalData?: any) {
 
         }
 
@@ -21,9 +21,9 @@
          * @param source the source mesh that triggered the event
          * @param evt {Event} The original (browser) event
          */
-        public static CreateNew(source: AbstractMesh, evt?: Event): ActionEvent {
+        public static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent {
             var scene = source.getScene();
-            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
+            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
         }
 
         /**

+ 2 - 2
src/babylon.scene.js

@@ -1225,7 +1225,7 @@ var BABYLON;
                         var currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);
                         if (areIntersecting && currentIntersectionInProgress === -1) {
                             if (action.trigger === BABYLON.ActionManager.OnIntersectionEnterTrigger) {
-                                action._executeCurrent(BABYLON.ActionEvent.CreateNew(sourceMesh));
+                                action._executeCurrent(BABYLON.ActionEvent.CreateNew(sourceMesh, null, otherMesh));
                                 sourceMesh._intersectionsInProgress.push(otherMesh);
                             }
                             else if (action.trigger === BABYLON.ActionManager.OnIntersectionExitTrigger) {
@@ -1236,7 +1236,7 @@ var BABYLON;
                             //They intersected, and now they don't.
                             //is this trigger an exit trigger? execute an event.
                             if (action.trigger === BABYLON.ActionManager.OnIntersectionExitTrigger) {
-                                action._executeCurrent(BABYLON.ActionEvent.CreateNew(sourceMesh));
+                                action._executeCurrent(BABYLON.ActionEvent.CreateNew(sourceMesh, null, otherMesh));
                             }
                             //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.
                             if (!sourceMesh.actionManager.hasSpecificTrigger(BABYLON.ActionManager.OnIntersectionExitTrigger) || action.trigger === BABYLON.ActionManager.OnIntersectionExitTrigger) {

+ 2 - 2
src/babylon.scene.ts

@@ -1569,7 +1569,7 @@
 
                         if (areIntersecting && currentIntersectionInProgress === -1) {
                             if (action.trigger === ActionManager.OnIntersectionEnterTrigger) {
-                                action._executeCurrent(ActionEvent.CreateNew(sourceMesh));
+                                action._executeCurrent(ActionEvent.CreateNew(sourceMesh, null, otherMesh));
                                 sourceMesh._intersectionsInProgress.push(otherMesh);
                             } else if (action.trigger === ActionManager.OnIntersectionExitTrigger) {
                                 sourceMesh._intersectionsInProgress.push(otherMesh);
@@ -1579,7 +1579,7 @@
 
                             //is this trigger an exit trigger? execute an event.
                             if (action.trigger === ActionManager.OnIntersectionExitTrigger) {
-                                action._executeCurrent(ActionEvent.CreateNew(sourceMesh));
+                                action._executeCurrent(ActionEvent.CreateNew(sourceMesh, null, otherMesh));
                             }
 
                             //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.