@weasel-js/gestures 1.5.0 → 1.5.2

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +34 -15
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -655,18 +655,25 @@ interface ClickEvent extends EventModifiers {
655
655
  * Forwarded into action params so click invokers can act on the click's
656
656
  * position without their own pointer-listener plumbing.
657
657
  */
658
- worldX?: number;
659
- worldY?: number;
658
+ x?: number;
659
+ y?: number;
660
+ /**
661
+ * Client/screen-space coordinates of the release, straight off the DOM
662
+ * event. What an action that has to place DOM at the pointer reads, via
663
+ * `InvocationCtx.screen`.
664
+ */
665
+ clientX?: number;
666
+ clientY?: number;
660
667
  /**
661
668
  * World-space coordinates of the *press* that opened this click, as opposed
662
- * to `worldX`/`worldY`, which are the release. The two differ by up to the
669
+ * to `x`/`y`, which are the release. The two differ by up to the
663
670
  * drag threshold (4px screen).
664
671
  *
665
672
  * Actions that place geometry at the click want this one — a click's
666
673
  * location reads as where the user put the pointer down, and pinning to the
667
674
  * press point keeps a snapped coordinate stable against the small drift
668
675
  * between press and release. Absent when the `clientToWorld` thunk isn't
669
- * wired, same as `worldX`/`worldY`.
676
+ * wired, same as `x`/`y`.
670
677
  */
671
678
  pressX?: number;
672
679
  pressY?: number;
@@ -682,12 +689,14 @@ interface ClickEvent extends EventModifiers {
682
689
  bodyTarget?: BodyTarget;
683
690
  bodyKind?: BodyKind;
684
691
  }
685
- /** A double click. `worldX`/`worldY` carry the same meaning as on {@link ClickEvent}. */
692
+ /** A double click. `x`/`y` carry the same meaning as on {@link ClickEvent}. */
686
693
  interface DoubleClickEvent extends EventModifiers {
687
694
  kind: 'doubleclick';
688
695
  target?: unknown;
689
- worldX?: number;
690
- worldY?: number;
696
+ x?: number;
697
+ y?: number;
698
+ clientX?: number;
699
+ clientY?: number;
691
700
  /** Affordance the originating press landed on, replayed from it. */
692
701
  affordance?: unknown;
693
702
  bodyTarget?: BodyTarget;
@@ -698,8 +707,12 @@ interface ContextMenuEvent extends EventModifiers {
698
707
  kind: 'contextmenu';
699
708
  target?: unknown;
700
709
  /** World-space position of the request. */
701
- worldX?: number;
702
- worldY?: number;
710
+ x?: number;
711
+ y?: number;
712
+ /** Client/screen-space position of the request. A context menu is the
713
+ * canonical "place DOM at the pointer" case, so this is the one it needs. */
714
+ clientX?: number;
715
+ clientY?: number;
703
716
  affordance?: unknown;
704
717
  bodyTarget?: BodyTarget;
705
718
  bodyKind?: BodyKind;
@@ -724,18 +737,24 @@ interface MultitouchEvent extends EventModifiers {
724
737
  kind: 'multitouch';
725
738
  fingers: number;
726
739
  /**
727
- * Centroid of active pointers in screen space. Populated by
728
- * `useGestureDispatcher` on the pointermove-pump of a running multitouch
729
- * handle (updated each frame). Absent on the initial pointerdown-triggered
730
- * multitouch event.
740
+ * Centroid of active pointers in **canvas-local** CSS pixels — client
741
+ * coordinates with the canvas's bounding-rect origin already subtracted,
742
+ * which is the space `zoomAt` anchors in. Not client coords, and not world:
743
+ * calling `clientToWorld` on it subtracts the canvas origin a second time.
744
+ *
745
+ * Populated by `useGestureDispatcher` on the pointermove-pump of a running
746
+ * multitouch handle (updated each frame). Absent on the initial
747
+ * pointerdown-triggered multitouch event.
731
748
  */
732
749
  centroid?: {
733
750
  x: number;
734
751
  y: number;
735
752
  };
736
753
  /**
737
- * Distance between the two primary pointers (screen space). Populated on
738
- * move-pump events alongside `centroid`. Absent on the initial event.
754
+ * Distance between the two primary pointers, in CSS pixels. A distance is
755
+ * origin-free, so it reads the same in client and canvas-local space.
756
+ * Populated on move-pump events alongside `centroid`. Absent on the initial
757
+ * event.
739
758
  */
740
759
  spread?: number;
741
760
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasel-js/gestures",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Pure gesture taxonomy, route grammars, and matcher primitives. No React, no DOM, no scene.",
5
5
  "license": "MIT",
6
6
  "type": "module",