@woosh/meep-engine 2.126.16 → 2.126.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.126.16",
8
+ "version": "2.126.18",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"KeyboardDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/KeyboardDevice.js"],"names":[],"mappings":";AAYA;;;;;;;;GAQG;AACH;IA4BI;;;OAGG;IACH,wBAHW,WAAW,GAAC,OAAO,EAgC7B;IA3DD;;OAEG;IACH;QACI;;;WAGG;cADO,MAAM,CAAC,aAAa,CAAC;QAG/B;;;WAGG;YADO,MAAM,CAAC,aAAa,CAAC;MAGjC;IAEF;;;;;;;OAOG;IACH,mBAAU;IAkBN;;;OAGG;IACH,YAFU,WAAW,CAEO;IA8FhC;;;OAGG;IACH,SAFa,IAAI,CAMhB;IAED;;;OAGG;IACH,QAFa,IAAI,CAMhB;;CAEJ;mBAvLkB,uCAAuC"}
1
+ {"version":3,"file":"KeyboardDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/KeyboardDevice.js"],"names":[],"mappings":";AAYA;;;;;;;;GAQG;AACH;IA4BI;;;OAGG;IACH,wBAHW,WAAW,GAAC,OAAO,EAgC7B;IA3DD;;OAEG;IACH;QACI;;;WAGG;cADO,MAAM,CAAC,aAAa,CAAC;QAG/B;;;WAGG;YADO,MAAM,CAAC,aAAa,CAAC;MAGjC;IAEF;;;;;;;OAOG;IACH,mBAAU;IAkBN;;;OAGG;IACH,YAFU,WAAW,CAEO;IA8FhC;;;OAGG;IACH,SAFa,IAAI,CAahB;IAED;;;OAGG;IACH,QAFa,IAAI,CAahB;;CAEJ;mBArMkB,uCAAuC"}
@@ -153,7 +153,7 @@ class KeyboardDevice {
153
153
  *
154
154
  * @param {FocusEvent} event
155
155
  */
156
- #handleGlobalBlurEvent(event) {
156
+ #handleGlobalBlurEvent = (event) => {
157
157
  // Element lost focus, we won't be able to capture key-up events
158
158
  // release all keys
159
159
  for (let keyName in KeyCodes) {
@@ -166,8 +166,15 @@ class KeyboardDevice {
166
166
  * @returns {void}
167
167
  */
168
168
  start() {
169
- this.domElement.addEventListener(KeyboardEvents.KeyDown, this.#handlerKeyDown);
170
- this.domElement.addEventListener(KeyboardEvents.KeyUp, this.#handlerKeyUp);
169
+ const el = this.domElement;
170
+ el.addEventListener(KeyboardEvents.KeyDown, this.#handlerKeyDown);
171
+ el.addEventListener(KeyboardEvents.KeyUp, this.#handlerKeyUp);
172
+
173
+ el.addEventListener('blur', this.#handleGlobalBlurEvent);
174
+
175
+ //https://w3c.github.io/uievents/#event-type-focusout
176
+ el.addEventListener('focusout', this.#handleGlobalBlurEvent);
177
+
171
178
  window.addEventListener('blur', this.#handleGlobalBlurEvent);
172
179
  }
173
180
 
@@ -176,8 +183,15 @@ class KeyboardDevice {
176
183
  * @returns {void}
177
184
  */
178
185
  stop() {
179
- this.domElement.removeEventListener(KeyboardEvents.KeyDown, this.#handlerKeyDown);
180
- this.domElement.removeEventListener(KeyboardEvents.KeyUp, this.#handlerKeyUp);
186
+ const el = this.domElement;
187
+ el.removeEventListener(KeyboardEvents.KeyDown, this.#handlerKeyDown);
188
+ el.removeEventListener(KeyboardEvents.KeyUp, this.#handlerKeyUp);
189
+
190
+ el.removeEventListener('blur', this.#handleGlobalBlurEvent);
191
+
192
+ //https://w3c.github.io/uievents/#event-type-focusout
193
+ el.removeEventListener('focusout', this.#handleGlobalBlurEvent);
194
+
181
195
  window.removeEventListener('blur', this.#handleGlobalBlurEvent);
182
196
  }
183
197