@orbat-mapper/tactical-draw 0.15.0 → 0.15.1

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 +17 -2
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -6246,6 +6246,7 @@ function runGroupTransform(opts) {
6246
6246
  optionsOverride: null,
6247
6247
  box: null,
6248
6248
  lastBoxPixels: [],
6249
+ lastFeatures: [],
6249
6250
  usesGraphicStack: isOnGraphicsLayer(graphic.id)
6250
6251
  };
6251
6252
  }
@@ -6262,6 +6263,7 @@ function runGroupTransform(opts) {
6262
6263
  optionsOverride: null,
6263
6264
  box: null,
6264
6265
  lastBoxPixels: [],
6266
+ lastFeatures: [],
6265
6267
  usesGraphicStack: isOnGraphicsLayer(graphic.id)
6266
6268
  };
6267
6269
  }
@@ -6439,6 +6441,15 @@ function runGroupTransform(opts) {
6439
6441
  return box ? boxCorners(box) : null;
6440
6442
  }
6441
6443
  /**
6444
+ * The pixels a measure member's box is fitted from. A Text member renders a
6445
+ * single Point; use its rotated-text footprint corners so the group box grows
6446
+ * to contain the text extent (else the lone Point contributes a degenerate,
6447
+ * unscalable box).
6448
+ */
6449
+ function measureBoxPixels(kind, features) {
6450
+ return (kind === "text" ? textFootprintCorners(features) : null) ?? pixelsFromFeatures(features);
6451
+ }
6452
+ /**
6442
6453
  * Fold a box gesture's delta (`box` vs the pre-drag box) into each measure
6443
6454
  * member that persists orientation/size as options (e.g. Text), off the
6444
6455
  * per-member `baseOverrides` so live ticks recompute rather than compound.
@@ -6545,13 +6556,14 @@ function runGroupTransform(opts) {
6545
6556
  } else {
6546
6557
  const working = workingGraphicFor(i);
6547
6558
  features = renderMeasureForAdapter(adapter, working, renderOpts).features;
6548
- boxPixels = (working.kind === "text" ? textFootprintCorners(features) : null) ?? pixelsFromFeatures(features);
6559
+ boxPixels = measureBoxPixels(working.kind, features);
6549
6560
  }
6550
6561
  } catch {
6551
6562
  features = [];
6552
6563
  boxPixels = [];
6553
6564
  }
6554
6565
  member.lastBoxPixels = boxPixels;
6566
+ member.lastFeatures = features;
6555
6567
  (member.usesGraphicStack ? workingGroups : previewGroups).push({
6556
6568
  id: member.graphic.id,
6557
6569
  features,
@@ -6567,7 +6579,10 @@ function runGroupTransform(opts) {
6567
6579
  function rescaleOnViewChange() {
6568
6580
  if (ctx.settled) return;
6569
6581
  if (members.some((m) => isAnchoredMember(m) || measureRendersFromViewState(m.graphic))) renderAllPreviews();
6570
- else refitBoxes();
6582
+ else {
6583
+ for (const member of members) member.lastBoxPixels = measureBoxPixels(member.graphic.kind, member.lastFeatures);
6584
+ refitBoxes();
6585
+ }
6571
6586
  renderHandlesLayer();
6572
6587
  }
6573
6588
  function renderHandlesLayer() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
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",