@antha/input 0.4.2 → 0.4.3

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.
@@ -49,7 +49,7 @@ export type MenuNavOptions = Readonly<Partial<{
49
49
  /**
50
50
  * The duration that any menu nav binding must be held before it starts auto-repeating.
51
51
  *
52
- * @default {milliseconds: 500}
52
+ * @default {milliseconds: 750}
53
53
  */
54
54
  repeatThreshold: Readonly<AnyDuration>;
55
55
  /**
@@ -224,7 +224,7 @@ export const defaultMenuNavBindings = {
224
224
  /** @category Internal */
225
225
  export const defaultMenuNavOptions = {
226
226
  repeatThreshold: {
227
- milliseconds: 500,
227
+ milliseconds: 750,
228
228
  },
229
229
  repeatInterval: {
230
230
  milliseconds: 60,
@@ -256,7 +256,13 @@ export function createAnthaMenuNavMod(options = {}) {
256
256
  ...options,
257
257
  });
258
258
  }
259
- if (!state.isInMenu || !state.menuNavOptions || !state.activeBindings) {
259
+ if (!state.menuNavOptions || !state.activeBindings) {
260
+ return;
261
+ }
262
+ else if (!state.isInMenu) {
263
+ consumeInactiveMenuActivationBindings({
264
+ activeBindings: state.activeBindings,
265
+ });
260
266
  return;
261
267
  }
262
268
  const repeatThreshold = convertDuration(state.menuNavOptions.repeatThreshold, {
@@ -346,3 +352,18 @@ export function createAnthaMenuNavMod(options = {}) {
346
352
  },
347
353
  });
348
354
  }
355
+ function consumeInactiveMenuActivationBindings({ activeBindings, }) {
356
+ getObjectTypedValues(activeBindings).forEach((playerActiveBindings) => {
357
+ [
358
+ MenuNavBinding.MenuEnter,
359
+ MenuNavBinding.MenuExit,
360
+ ].forEach((bindingName) => {
361
+ const activeBinding = playerActiveBindings[bindingName];
362
+ if (!activeBinding || activeBinding.actCount) {
363
+ return;
364
+ }
365
+ activeBinding.actCount++;
366
+ activeBinding.lastActDuration = activeBinding.holdDuration;
367
+ });
368
+ });
369
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antha/input",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "An Antha mod for handling inputs.",
5
5
  "keywords": [
6
6
  "vir",
@@ -33,7 +33,7 @@
33
33
  "test:docs": "virmator docs check"
34
34
  },
35
35
  "dependencies": {
36
- "@antha/gamepad-type": "^0.4.2",
36
+ "@antha/gamepad-type": "^0.4.3",
37
37
  "@augment-vir/assert": "^32.2.3",
38
38
  "@augment-vir/common": "^32.2.3",
39
39
  "date-vir": "^9.1.1",
@@ -51,7 +51,7 @@
51
51
  "istanbul-smart-text-reporter": "^1.1.5"
52
52
  },
53
53
  "peerDependencies": {
54
- "@antha/engine": "^0.4.2",
54
+ "@antha/engine": "^0.4.3",
55
55
  "element-vir": ">=26"
56
56
  },
57
57
  "engines": {