@orbat-mapper/tactical-draw 0.4.3 → 0.4.5

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 +12 -6
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -2656,15 +2656,18 @@ function segmentMidpoint(a, b) {
2656
2656
  * an empty control-point list.
2657
2657
  */
2658
2658
  function buildHandleSet(controlPoints, modes, options = {}) {
2659
- const { includeMidpoints = true, trailingFixedSlots = 0, closedRing = false } = options;
2659
+ const { includeMidpoints = true, hiddenControlPointIndices = [], trailingFixedSlots = 0, closedRing = false } = options;
2660
2660
  const handles = [];
2661
2661
  const wantsReshape = modes.includes("reshape");
2662
2662
  if (wantsReshape || modes.includes("delete")) {
2663
- for (let i = 0; i < controlPoints.length; i++) handles.push({
2664
- kind: "vertex",
2665
- index: i,
2666
- position: [...controlPoints[i]]
2667
- });
2663
+ for (let i = 0; i < controlPoints.length; i++) {
2664
+ if (hiddenControlPointIndices.includes(i)) continue;
2665
+ handles.push({
2666
+ kind: "vertex",
2667
+ index: i,
2668
+ position: [...controlPoints[i]]
2669
+ });
2670
+ }
2668
2671
  if (wantsReshape && includeMidpoints) {
2669
2672
  const edgeCount = closedRing && trailingFixedSlots === 0 && controlPoints.length >= 3 ? controlPoints.length : controlPoints.length - 1 - trailingFixedSlots;
2670
2673
  for (let i = 0; i < edgeCount; i++) {
@@ -3946,6 +3949,7 @@ function runEdit(opts) {
3946
3949
  const metadata = getControlMeasureMetadata(measure.kind);
3947
3950
  const rule = metadata.rule;
3948
3951
  const midpointHandlesEnabled = rule?.canonicalPointCount === void 0;
3952
+ const hiddenControlPointIndices = rule?.hiddenControlPointIndices ?? [];
3949
3953
  const trailingFixedSlots = rule?.trailingFixedSlots ?? 0;
3950
3954
  const closedRing = rule?.closedRing ?? false;
3951
3955
  const guideEnabled = (guideOpt ?? true) && !shouldSuppressGuide(metadata);
@@ -4181,6 +4185,7 @@ function runEdit(opts) {
4181
4185
  if (ctx.settled) return;
4182
4186
  const features = toFeatures(buildHandleSet(workingPoints, modes, {
4183
4187
  includeMidpoints: midpointHandlesEnabled,
4188
+ hiddenControlPointIndices,
4184
4189
  trailingFixedSlots,
4185
4190
  closedRing
4186
4191
  }), handleIdPrefix, interactionStyle);
@@ -4790,6 +4795,7 @@ function runEdit(opts) {
4790
4795
  }
4791
4796
  const hit = pickHandle(buildHandleSet(workingPoints, modes, {
4792
4797
  includeMidpoints: midpointHandlesEnabled,
4798
+ hiddenControlPointIndices,
4793
4799
  trailingFixedSlots,
4794
4800
  closedRing
4795
4801
  }), pixel, tol, (lonLat) => driver.toPixel(lonLat));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
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.9.0"
42
+ "@orbat-mapper/control-measures": "^0.11.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "vitest": ">=4.0.0"