@orbat-mapper/tactical-draw 0.2.0-alpha.40 → 0.2.0-alpha.41

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 +18 -3
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -1875,7 +1875,14 @@ function runFixedLengthDraw(options) {
1875
1875
  }
1876
1876
  const handleClick = (event) => {
1877
1877
  if (ctx.settled) return;
1878
- committed.push(snappedDrawPosition(snap, event));
1878
+ const position = snappedDrawPosition(snap, event);
1879
+ const last = committed[committed.length - 1];
1880
+ const earlyFinishThreshold = rule?.minimumPreviewPoints ?? required;
1881
+ if (rule?.finishOnLastPointRepeat === true && committed.length >= earlyFinishThreshold && committed.length < required && last !== void 0 && positionsEqual$1(roundControlPoint(position), roundControlPoint(last))) {
1882
+ ctx.commit(buildSnapshot);
1883
+ return;
1884
+ }
1885
+ committed.push(position);
1879
1886
  rubberBand = void 0;
1880
1887
  if (committed.length >= required) {
1881
1888
  ctx.commit(buildSnapshot);
@@ -1987,6 +1994,13 @@ function runFixedLengthDraw(options) {
1987
1994
  }
1988
1995
  });
1989
1996
  }
1997
+ function positionsEqual$1(a, b) {
1998
+ if (a[0] !== b[0] || a[1] !== b[1]) return false;
1999
+ const az = a[2];
2000
+ const bz = b[2];
2001
+ if (az === void 0 && bz === void 0) return true;
2002
+ return az === bz;
2003
+ }
1990
2004
  /**
1991
2005
  * Produce preview features for the partial geometry. Tries the full renderer
1992
2006
  * first so the preview looks like the real symbol once enough points are in;
@@ -6762,8 +6776,9 @@ var TacticalDraw = class {
6762
6776
  const kind = measureDraft.kind;
6763
6777
  const preempt = this.guardAndPreempt();
6764
6778
  if (preempt) return preempt;
6765
- const fixedLength = isFixedLength(getControlMeasureMetadata(kind));
6766
- const suppressDblclickZoom = !fixedLength && !options?.signal?.aborted;
6779
+ const metadata = getControlMeasureMetadata(kind);
6780
+ const fixedLength = isFixedLength(metadata);
6781
+ const suppressDblclickZoom = (!fixedLength || metadata.rule?.finishOnLastPointRepeat === true) && !options?.signal?.aborted;
6767
6782
  if (suppressDblclickZoom) this.adapter.setDoubleClickZoomEnabled(false);
6768
6783
  const revertGuideStyle = this.applyGuideStyle(options?.interactionStyle?.guide);
6769
6784
  const extraSettle = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw",
3
- "version": "0.2.0-alpha.40",
3
+ "version": "0.2.0-alpha.41",
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",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@orbat-mapper/control-measures": "^0.2.0-alpha.30"
42
+ "@orbat-mapper/control-measures": "^0.2.0-alpha.31"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "vitest": ">=4.0.0"