@weasel-js/routing 1.5.1 → 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.
@@ -488,11 +488,10 @@ function worldPointOf(event) {
488
488
  switch (event.kind) {
489
489
  case "pointerdown":
490
490
  case "longpress":
491
- return event.x !== void 0 && event.y !== void 0 ? { x: event.x, y: event.y } : void 0;
492
491
  case "click":
493
492
  case "doubleclick":
494
493
  case "contextmenu":
495
- return event.worldX !== void 0 && event.worldY !== void 0 ? { x: event.worldX, y: event.worldY } : void 0;
494
+ return event.x !== void 0 && event.y !== void 0 ? { x: event.x, y: event.y } : void 0;
496
495
  default:
497
496
  return void 0;
498
497
  }
@@ -548,9 +547,9 @@ function createDispatcher(opts) {
548
547
  base.key = { key: event.key, repeat: false };
549
548
  } else if (event.kind === "wheel") {
550
549
  base.wheel = { deltaX: event.deltaX, deltaY: event.deltaY, deltaZ: 0 };
551
- } else if (event.kind === "pointerdown" || event.kind === "click") {
552
- const sx = event.kind === "pointerdown" ? event.x ?? 0 : event.worldX ?? event.pressX ?? 0;
553
- const sy = event.kind === "pointerdown" ? event.y ?? 0 : event.worldY ?? event.pressY ?? 0;
550
+ } else if (event.kind === "pointerdown" || event.kind === "click" || event.kind === "doubleclick" || event.kind === "contextmenu") {
551
+ const sx = event.x ?? (event.kind === "click" ? event.pressX : void 0) ?? 0;
552
+ const sy = event.y ?? (event.kind === "click" ? event.pressY : void 0) ?? 0;
554
553
  base.world = { x: sx, y: sy };
555
554
  const affordance = event.kind === "pointerdown" ? event.affordance : void 0;
556
555
  base.drag = {
@@ -566,7 +565,8 @@ function createDispatcher(opts) {
566
565
  const origin = gestureId ? dragOrigins.get(gestureId) : void 0;
567
566
  const ox = origin?.x ?? cx;
568
567
  const oy = origin?.y ?? cy;
569
- const points = gestureId ? dragPoints.get(gestureId) : void 0;
568
+ const live = gestureId ? dragPoints.get(gestureId) : void 0;
569
+ const points = live && event.kind === "pointerup" ? [...live] : live;
570
570
  const eventClientX = event.clientX;
571
571
  const eventClientY = event.clientY;
572
572
  const hasClient = eventClientX !== void 0 && eventClientY !== void 0 && origin?.clientX !== void 0 && origin?.clientY !== void 0;
@@ -791,8 +791,8 @@ function createDispatcher(opts) {
791
791
  };
792
792
  } else if (event.kind === "click" || event.kind === "doubleclick") {
793
793
  params = {
794
- worldX: event.worldX,
795
- worldY: event.worldY,
794
+ worldX: event.x,
795
+ worldY: event.y,
796
796
  affordance: event.affordance,
797
797
  // Press point as well as release point — an action that places
798
798
  // geometry at the click wants the former. See `ClickEvent`.
@@ -802,8 +802,8 @@ function createDispatcher(opts) {
802
802
  };
803
803
  } else if (event.kind === "contextmenu" || event.kind === "longpress") {
804
804
  params = {
805
- worldX: event.kind === "contextmenu" ? event.worldX : event.x,
806
- worldY: event.kind === "contextmenu" ? event.worldY : event.y,
805
+ worldX: event.x,
806
+ worldY: event.y,
807
807
  affordance: event.affordance,
808
808
  bodyTarget: event.bodyTarget,
809
809
  mods: modifiersOf(event),
@@ -1510,5 +1510,5 @@ function dlog(namespace, ...args) {
1510
1510
  }
1511
1511
 
1512
1512
  export { ALWAYS, COARSE_TARGET_SCALE, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEVICE_PROFILE, INGEST_STRING_MIMES, NEVER, PREDICATE_TARGET, TOOL_OFFHAND_ID, actionBindings, buildDepsFromRequires, buildRouteRegistry, buildRuleCtx, buildToolOffhandBindings, clientToCanvas, clientToCanvasRect, createDispatcher, describeRule, dlog, evaluate, filterEligible, findConflicts, isDev, isEditableTarget, itemsFromClipboardData, itemsFromDataTransfer, itemsFromFiles, liveScope, makeToolOffhandAction, matchBest, matchSorted, matchesKeyBinding, offhandKeyFor, openPointerSession, pointerGestureId, recordModeSwitch, reportRouteConflicts, resolveDeviceProfile, resolveParams, routeGestureForSpecKind, routesForSpec, scopeBindings, specificity, targetConsultsAffordance, validateActionDefaultBinding, validateActionId };
1513
- //# sourceMappingURL=chunk-ZZICE4J7.js.map
1514
- //# sourceMappingURL=chunk-ZZICE4J7.js.map
1513
+ //# sourceMappingURL=chunk-H5AGTB2J.js.map
1514
+ //# sourceMappingURL=chunk-H5AGTB2J.js.map