@orbat-mapper/tactical-draw 0.2.0-alpha.14 → 0.2.0-alpha.15

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.mjs +28 -7
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -2035,9 +2035,11 @@ const HANDLE_HIT_TOLERANCE_PX$1 = 12;
2035
2035
  * A body drag (drag-anywhere-inside-the-box translate) whose release pixel
2036
2036
  * lands within this many pixels of the down pixel is treated as a plain
2037
2037
  * click, not a gesture: it is not committed (geometry restored, no
2038
- * `EditChangeEvent`, `dirty` untouched) but the click-away listener is
2039
- * suppressed so the click doesn't close the edit. Corner/rotate drags commit
2040
- * even at zero movement (matches the pre-ADR-0017 translate/rotate seams).
2038
+ * `EditChangeEvent`, `dirty` untouched). The click-away's *empty-map* close is
2039
+ * suppressed so the click doesn't end the edit, but a pick on another
2040
+ * graphics-layer measure inside the box still closes-then-selects it.
2041
+ * Corner/rotate drags commit even at zero movement (matches the pre-ADR-0017
2042
+ * translate/rotate seams).
2041
2043
  */
2042
2044
  const CLICK_SLOP_PX$1 = 3;
2043
2045
  const ALLOWED_EDIT_MODES = new Set([
@@ -2083,6 +2085,15 @@ function runEdit(opts) {
2083
2085
  */
2084
2086
  let suppressClickAway = false;
2085
2087
  /**
2088
+ * Set when a zero-movement body drag (a plain click inside the transform
2089
+ * box) released this pointer cycle. Unlike {@link suppressClickAway} it only
2090
+ * suppresses the *empty-map* close in `handleClick` — a stashed pick on
2091
+ * another graphics-layer measure still closes-then-re-dispatches, so
2092
+ * measures sitting inside a large box stay selectable. Consumed by the next
2093
+ * `handleClick`.
2094
+ */
2095
+ let bodyClickPending = false;
2096
+ /**
2086
2097
  * Mutable style snapshot. Initialised from the edit-start input; replaced
2087
2098
  * when the façade routes an external style change to us via
2088
2099
  * `notifyExternalMeasure`. `EditSession.measure` stays the immutable
@@ -2768,7 +2779,7 @@ function runEdit(opts) {
2768
2779
  renderHandlesLayer();
2769
2780
  recomputeDirty();
2770
2781
  endDragBookkeeping();
2771
- suppressClickAway = true;
2782
+ bodyClickPending = true;
2772
2783
  return;
2773
2784
  }
2774
2785
  const finalSnapshot = fsm.move(pixel);
@@ -2794,21 +2805,25 @@ function runEdit(opts) {
2794
2805
  const localPreview = pickPreview;
2795
2806
  const localHandles = pickHandles;
2796
2807
  const localGraphics = pickGraphics;
2808
+ const wasBodyClick = bodyClickPending;
2797
2809
  pickPreview = void 0;
2798
2810
  pickHandles = void 0;
2799
2811
  pickGraphics = void 0;
2812
+ bodyClickPending = false;
2800
2813
  if (ctx.settled) return;
2801
2814
  if (!closeOnClickAway) return;
2802
2815
  if (suppressClickAway) {
2803
2816
  suppressClickAway = false;
2804
2817
  return;
2805
2818
  }
2806
- if (localPreview || localHandles) return;
2819
+ if (localHandles) return;
2807
2820
  if (localGraphics && localGraphics.id !== measure.id) {
2808
2821
  ctx.commit(rebuildRendered);
2809
2822
  if (onClickAwayGraphicsPick) onClickAwayGraphicsPick(localGraphics);
2810
2823
  return;
2811
2824
  }
2825
+ if (localPreview) return;
2826
+ if (wasBodyClick) return;
2812
2827
  ctx.commit(rebuildRendered);
2813
2828
  };
2814
2829
  const core = runInteraction({
@@ -3015,6 +3030,8 @@ function runGroupTransform(opts) {
3015
3030
  let dragInFlight = false;
3016
3031
  /** Same click-away suppression role as `edit-controller.ts`'s flag of the same name. */
3017
3032
  let suppressClickAway = false;
3033
+ /** Same body-click role as `edit-controller.ts`'s flag of the same name. */
3034
+ let bodyClickPending = false;
3018
3035
  const changeListeners = /* @__PURE__ */ new Set();
3019
3036
  const commitEmitter = createCommitEmitter("TransformSession.onCommit listener errors");
3020
3037
  const settleEmitter = createSettleEmitter("TransformSession.onSettled listener errors");
@@ -3448,7 +3465,7 @@ function runGroupTransform(opts) {
3448
3465
  renderHandlesLayer();
3449
3466
  recomputeDirty();
3450
3467
  dragInFlight = false;
3451
- suppressClickAway = true;
3468
+ bodyClickPending = true;
3452
3469
  return;
3453
3470
  }
3454
3471
  const finalSnapshot = fsm.move(pixel);
@@ -3472,22 +3489,26 @@ function runGroupTransform(opts) {
3472
3489
  const localPreview = pickPreview;
3473
3490
  const localHandles = pickHandles;
3474
3491
  const localGraphics = pickGraphics;
3492
+ const wasBodyClick = bodyClickPending;
3475
3493
  pickPreview = void 0;
3476
3494
  pickHandles = void 0;
3477
3495
  pickGraphics = void 0;
3496
+ bodyClickPending = false;
3478
3497
  if (ctx.settled) return;
3479
3498
  if (!closeOnClickAway) return;
3480
3499
  if (suppressClickAway) {
3481
3500
  suppressClickAway = false;
3482
3501
  return;
3483
3502
  }
3484
- if (localPreview || localHandles) return;
3503
+ if (localHandles) return;
3485
3504
  const isMember = localGraphics ? members.some((m) => m.measure.id === localGraphics.id) : false;
3486
3505
  if (localGraphics && !isMember) {
3487
3506
  commitClose();
3488
3507
  if (onClickAwayGraphicsPick) onClickAwayGraphicsPick(localGraphics);
3489
3508
  return;
3490
3509
  }
3510
+ if (localPreview) return;
3511
+ if (wasBodyClick) return;
3491
3512
  commitClose();
3492
3513
  };
3493
3514
  const core = runInteraction({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw",
3
- "version": "0.2.0-alpha.14",
3
+ "version": "0.2.0-alpha.15",
4
4
  "description": "Engine-agnostic draw/edit core for tactical control measures (MIL-STD-2525 / APP-6). The MapAdapter ABI and bring-your-own-engine entry point for the tactical-draw package family.",
5
5
  "license": "MIT",
6
6
  "author": "Orbat Mapper",