@3dsource/angular-unreal-module 0.0.181 → 0.0.182

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.
@@ -316,24 +316,46 @@ const MouseButtonsMask = {
316
316
  * punctuation keys by ASCII — `;` as 59, `=` as 61, `-` as 173) and keys Unreal
317
317
  * numbers differently from the DOM (the right-hand modifiers, the Cmd/Win keys).
318
318
  *
319
- * The numpad is deliberately absent. A numpad key reports the same `code` in
320
- * both NumLock states but a different virtual key — `Numpad4` is 37/`VK_LEFT`
321
- * with NumLock off and 100/`VK_NUMPAD4` with it on — so any entry here would
322
- * have to commit to one state and be wrong in the other. Falling through to
323
- * `event.keyCode` is right in both. `NumpadAdd`/`Subtract`/`Multiply`/`Divide`
324
- * stay because they do not change with NumLock.
319
+ * The numpad digits, `NumpadDecimal` and `NumpadEnter` are the exception to the
320
+ * rule above, and the reason it is worded as a rule. A numpad key reports the
321
+ * same `code` in both NumLock states but a different virtual key — `Numpad4` is
322
+ * 37/`VK_LEFT` with NumLock off and 100/`VK_NUMPAD4` with it on. Their entries
323
+ * here hold the NumLock-*off* values, so an entry wins over the value the
324
+ * browser resolved and pins that state: with NumLock on the engine is told
325
+ * `VK_LEFT`. Read `event.keyCode` directly if you need the other state.
326
+ * `NumpadAdd`/`Subtract`/`Multiply`/`Divide` carry no such caveat — they do not
327
+ * change with NumLock.
325
328
  *
326
329
  * `SpecialKeyCodes` in `./buttons-codes` repeats seven of these entries with
327
330
  * the same values. The two are kept apart because both are public API; merging
328
331
  * them would be a breaking change.
329
332
  *
330
- * Values must stay unique so `InvertedKeyMap` is lossless. The `OSLeft`/
331
- * `MetaLeft` and `OSRight`/`MetaRight` pairs share a value on purpose: they are
332
- * legacy and current names for the same physical key.
333
+ * `InvertedKeyMap` is consequently lossy. `NumpadEnter` and `Numpad4/8/6/2`
334
+ * share their values with `Enter` and `Arrow*`, and the derivation keeps the
335
+ * last name written for a value, so those five cannot be reached through it —
336
+ * which is what makes them unnameable through the numeric form of
337
+ * `useKeyboardKeys()`. The `OSLeft`/`MetaLeft` and `OSRight`/`MetaRight` pairs
338
+ * share a value on purpose: they are legacy and current names for the same
339
+ * physical key.
333
340
  */
334
341
  const KeyboardNumericCode = {
335
342
  Backspace: 8,
336
343
  Tab: 9,
344
+ // The NumLock-*off* virtual keys. Declared before `Enter` and the arrows on
345
+ // purpose: those come later and so win the `InvertedKeyMap` derivation, which
346
+ // keeps 13 resolving to `Enter` and 37-40 to `Arrow*`.
347
+ Numpad5: 12,
348
+ NumpadEnter: 13,
349
+ Numpad9: 33,
350
+ Numpad3: 34,
351
+ Numpad1: 35,
352
+ Numpad7: 36,
353
+ Numpad4: 37,
354
+ Numpad8: 38,
355
+ Numpad6: 39,
356
+ Numpad2: 40,
357
+ Numpad0: 45,
358
+ NumpadDecimal: 46,
337
359
  Enter: 13,
338
360
  ShiftLeft: 16,
339
361
  ControlLeft: 17,