Pārlūkot izejas kodu

engine.canvasTabIndex

David Catuhe 5 gadi atpakaļ
vecāks
revīzija
0e86b8c841
2 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 3 0
      src/Engines/engine.ts
  2. 3 2
      src/Inputs/scene.inputManager.ts

+ 3 - 0
src/Engines/engine.ts

@@ -437,6 +437,9 @@ export class Engine extends ThinEngine {
     /** @hidden */
     public _drawCalls = new PerfCounter();
 
+    /** Gets or sets the tab index to set to the rendering canvas. 1 is the minimum value to set to be able to capture keyboard events */
+    public canvasTabIndex = 1;
+
     /**
      * Turn this value on if you want to pause FPS computation when in background
      */

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

@@ -162,13 +162,14 @@ export class InputManager {
 
     private _processPointerMove(pickResult: Nullable<PickingInfo>, evt: PointerEvent) {
         let scene = this._scene;
-        var canvas = scene.getEngine().getInputElement();
+        let engine = scene.getEngine();
+        var canvas = engine.getInputElement();
 
         if (!canvas) {
             return;
         }
 
-        canvas.tabIndex = 1;
+        canvas.tabIndex = engine.canvasTabIndex;
 
         // Restore pointer
         if (!scene.doNotHandleCursors) {