Przeglądaj źródła

Merge pull request #8158 from sebavan/master

Fix #7995
sebavan 5 lat temu
rodzic
commit
e20d5653c6
2 zmienionych plików z 9 dodań i 3 usunięć
  1. 2 2
      src/Inputs/scene.inputManager.ts
  2. 7 1
      src/Misc/tools.ts

+ 2 - 2
src/Inputs/scene.inputManager.ts

@@ -794,7 +794,7 @@ export class InputManager {
         });
 
         // Pointer events
-        var eventPrefix = Tools.GetPointerPrefix();
+        var eventPrefix = Tools.GetPointerPrefix(engine);
 
         if (attachMove) {
             elementToAttachTo.addEventListener(eventPrefix + "move", <any>this._onPointerMove, false);
@@ -823,9 +823,9 @@ export class InputManager {
      * Detaches all event handlers
      */
     public detachControl() {
-        const eventPrefix = Tools.GetPointerPrefix();
         const canvas = this._scene.getEngine().getInputElement();
         const engine = this._scene.getEngine();
+        const eventPrefix = Tools.GetPointerPrefix(engine);
 
         if (!canvas) {
             return;

+ 7 - 1
src/Misc/tools.ts

@@ -281,9 +281,10 @@ export class Tools {
 
     /**
      * Gets the pointer prefix to use
+     * @param engine defines the engine we are finding the prefix for
      * @returns "pointer" if touch is enabled. Else returns "mouse"
      */
-    public static GetPointerPrefix(): string {
+    public static GetPointerPrefix(engine: Engine): string {
         var eventPrefix = "pointer";
 
         // Check if pointer events are supported
@@ -291,6 +292,11 @@ export class Tools {
             eventPrefix = "mouse";
         }
 
+        // Special Fallback...
+        if (engine._badDesktopOS) {
+            eventPrefix = "mouse";
+        }
+
         return eventPrefix;
     }