minimojs 1.0.0-alpha.27 → 1.0.0-alpha.28

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.
@@ -85,6 +85,8 @@ export class InputSystem {
85
85
  y: p.y,
86
86
  pressed: true,
87
87
  });
88
+ // A finger that touches while none is followed becomes the pointer,
89
+ // even when other fingers are still down.
88
90
  if (this._primaryTouchId === null) {
89
91
  this._primaryTouchId = touch.identifier;
90
92
  }
@@ -277,18 +279,9 @@ export class InputSystem {
277
279
  }
278
280
  this._primaryTouchId = null;
279
281
  }
280
- if (this._touchPointers.size > 0) {
281
- const firstTouchEntry = this._touchPointers.entries().next().value;
282
- if (firstTouchEntry) {
283
- const [touchId, touch] = firstTouchEntry;
284
- this._primaryTouchId = touchId;
285
- this._pointerX = touch.x;
286
- this._pointerY = touch.y;
287
- this._pointerDown = true;
288
- this._pointerPressed = touch.pressed;
289
- return;
290
- }
291
- }
282
+ // No finger is followed. Fingers still down are not adopted: the pointer
283
+ // reports the followed finger's release, and the next finger to touch
284
+ // is followed instead.
292
285
  this._primaryTouchId = null;
293
286
  const released = this._releasedTouch;
294
287
  this._pointerX = released ? released.x : this._mouseX;
package/dist/minimo.d.ts CHANGED
@@ -1316,6 +1316,11 @@ export declare class Game {
1316
1316
  * in pixels. Updated every `mousemove` / `touchmove` event.
1317
1317
  * `(0, 0)` is the top-left corner of the canvas.
1318
1318
  * To convert to world space: `worldX = game.pointerX + game.scrollX`.
1319
+ *
1320
+ * On a touch screen the pointer is one finger: the first to touch while no
1321
+ * finger is followed. Other fingers never move it, and when the followed
1322
+ * finger lifts, the pointer stays where it left the screen even if others
1323
+ * are still down. Use {@link Game.getPointers} to follow several fingers.
1319
1324
  */
1320
1325
  get pointerX(): number;
1321
1326
  /**
@@ -1616,6 +1621,8 @@ export declare class Game {
1616
1621
  * Use this for continuous pointer actions.
1617
1622
  *
1618
1623
  * **Hold behavior:** returns `true` every frame from press until release.
1624
+ * On a touch screen it follows one finger, as {@link Game.pointerX} does,
1625
+ * so it turns `false` when that finger lifts, even if another is down.
1619
1626
  *
1620
1627
  * @returns `true` if the pointer is currently pressed.
1621
1628
  *
package/dist/minimo.js CHANGED
@@ -1429,6 +1429,11 @@ export class Game {
1429
1429
  * in pixels. Updated every `mousemove` / `touchmove` event.
1430
1430
  * `(0, 0)` is the top-left corner of the canvas.
1431
1431
  * To convert to world space: `worldX = game.pointerX + game.scrollX`.
1432
+ *
1433
+ * On a touch screen the pointer is one finger: the first to touch while no
1434
+ * finger is followed. Other fingers never move it, and when the followed
1435
+ * finger lifts, the pointer stays where it left the screen even if others
1436
+ * are still down. Use {@link Game.getPointers} to follow several fingers.
1432
1437
  */
1433
1438
  get pointerX() {
1434
1439
  return this._inputSystem.pointerX;
@@ -1788,6 +1793,8 @@ export class Game {
1788
1793
  * Use this for continuous pointer actions.
1789
1794
  *
1790
1795
  * **Hold behavior:** returns `true` every frame from press until release.
1796
+ * On a touch screen it follows one finger, as {@link Game.pointerX} does,
1797
+ * so it turns `false` when that finger lifts, even if another is down.
1791
1798
  *
1792
1799
  * @returns `true` if the pointer is currently pressed.
1793
1800
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimojs",
3
- "version": "1.0.0-alpha.27",
3
+ "version": "1.0.0-alpha.28",
4
4
  "description": "MinimoJS v1 — ultra-minimal, flat, deterministic 2D web game engine. Image-first sprites with emoji as a zero-asset alternative, rAF loop, TypeScript-first, LLM-friendly.",
5
5
  "type": "module",
6
6
  "main": "dist/minimo.js",
@@ -21,7 +21,8 @@
21
21
  "clean": "rm -rf dist",
22
22
  "rebuild": "npm run clean && npm run build",
23
23
  "prepack": "npm run build",
24
- "pack:check": "npm pack --dry-run"
24
+ "pack:check": "npm pack --dry-run",
25
+ "test": "npm run build && node --test \"test/*.test.mjs\""
25
26
  },
26
27
  "keywords": [
27
28
  "game",