@orbat-mapper/tactical-draw 0.35.0 → 0.36.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.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as CollocationLocate, $t as DEFAULT_PIN_PRESENTATION, A as PointSymbolColors, At as validateCollocation, B as clonePointSymbol, Bt as isMarker, C as isMinePattern, Ct as collocationOpacity, D as PointSymbol, Dt as resolveCollocationLocation, E as OffsetDragModifier, Et as patchCollocationOptions, F as PointSymbolPlacement, Ft as MarkerRender, G as Collocation, Gt as EditModifiers, H as resizePointSymbolSize, Ht as normalizeMarker, I as PointSymbolRect, It as MarkerSize, J as CollocationBracketShape, Jt as ResolvedEditModifiers, K as CollocationAreaStyle, Kt as ModifierKey, L as PointSymbolRender, Lt as MarkerStyle, M as PointSymbolGraphicModifiers, Mt as MarkerAnchor, N as PointSymbolOffset, Nt as MarkerCapability, O as PointSymbolAnchor, Ot as resolveCollocationSize, P as PointSymbolOffsetStyle, Pt as MarkerIcon, Q as CollocationHalo, Qt as PointerEventInfo, R as PointSymbolSize, Rt as cloneMarker, S as fillPatternImageId, St as collocationMemberPart, T as parseColor, Tt as normalizeCollocation, U as BuildCollocationRenderOptions, Ut as validateMarker, V as isPointSymbol, Vt as markerOpacity, W as COLLOCATION_SCREEN_RELATIVE_REACH, Wt as DEFAULT_EDIT_MODIFIERS, X as CollocationCommitChanges, Xt as EditPointerDriver, Y as CollocationBracketSide, Yt as readPickModifiers, Z as CollocationGround, Zt as PointerCallback, _ as HATCH_PATTERNS, _t as CollocationStroke, a as ImageOverlayResource, an as PinPresentationState, at as CollocationMemberOptionTypes, b as Rgba, bt as buildCollocationRender, c as MapCursor, cn as PinPresentationStore, ct as CollocationMemberRenderContext, d as PickEvent, dn as isValidPinNumber, dt as CollocationPart, en as PinFootprint, et as CollocationMarker, f as PickHandler, fn as pinDistanceScale, ft as CollocationPartDrag, g as TextStyleOptions, gt as CollocationRenderMember, h as StyleOptions, ht as CollocationRender, i as IconResource, in as PinPresentationPatch, it as CollocationMemberIcon, j as PointSymbolConnector, jt as Marker, k as PointSymbolCapability, kt as stableCollocation, l as MapEvent, ln as PinRender, lt as CollocationMemberSupport, m as PixelCoordinate, mn as resolvePinPresentation, mt as CollocationPointSymbol, n as HandleStyle, nn as PinPresentation, nt as CollocationMemberCapabilities, o as LayerId, on as PinPresentationStatus, ot as CollocationMemberOptions, p as PickOptions, pn as pinZoomScale, pt as CollocationPlate, q as CollocationBracketPlacement, qt as PickModifiers, r as IconHitLine, rn as PinPresentationCapability, rt as CollocationMemberGraphic, s as MapAdapter, sn as PinPresentationStatusEvent, st as CollocationMemberRender, t as FeatureGroup, tn as PinOverridePatch, tt as CollocationMember, u as MapEventHandler, un as combinePinScale, ut as CollocationOptions, v as HatchPattern, vt as CollocationStyle, w as makeFillPatternImage, wt as isCollocation, x as fillPatternImageDimension, xt as cloneCollocation, y as MINE_PATTERN_TILE_SIZE, yt as ResolvedCollocationMemberRender, z as PointSymbolStyle, zt as composeMarkerCapabilities } from "./map-adapter-De1DC6Zy.mjs";
1
+ import { $ as CollocationLocate, $t as DEFAULT_PIN_PRESENTATION, A as PointSymbolColors, At as validateCollocation, B as clonePointSymbol, Bt as isMarker, C as isMinePattern, Ct as collocationOpacity, D as PointSymbol, Dt as resolveCollocationLocation, E as OffsetDragModifier, Et as patchCollocationOptions, F as PointSymbolPlacement, Ft as MarkerRender, G as Collocation, Gt as EditModifiers, H as resizePointSymbolSize, Ht as normalizeMarker, I as PointSymbolRect, It as MarkerSize, J as CollocationBracketShape, Jt as ResolvedEditModifiers, K as CollocationAreaStyle, Kt as ModifierKey, L as PointSymbolRender, Lt as MarkerStyle, M as PointSymbolGraphicModifiers, Mt as MarkerAnchor, N as PointSymbolOffset, Nt as MarkerCapability, O as PointSymbolAnchor, Ot as resolveCollocationSize, P as PointSymbolOffsetStyle, Pt as MarkerIcon, Q as CollocationHalo, Qt as PointerEventInfo, R as PointSymbolSize, Rt as cloneMarker, S as fillPatternImageId, St as collocationMemberPart, T as parseColor, Tt as normalizeCollocation, U as BuildCollocationRenderOptions, Ut as validateMarker, V as isPointSymbol, Vt as markerOpacity, W as COLLOCATION_SCREEN_RELATIVE_REACH, Wt as DEFAULT_EDIT_MODIFIERS, X as CollocationCommitChanges, Xt as EditPointerDriver, Y as CollocationBracketSide, Yt as readPickModifiers, Z as CollocationGround, Zt as PointerCallback, _ as HATCH_PATTERNS, _t as CollocationStroke, a as ImageOverlayResource, an as PinPresentationState, at as CollocationMemberOptionTypes, b as Rgba, bt as buildCollocationRender, c as MapCursor, cn as PinPresentationStore, ct as CollocationMemberRenderContext, d as PickEvent, dn as isValidPinNumber, dt as CollocationPart, en as PinFootprint, et as CollocationMarker, f as PickHandler, fn as pinDistanceScale, ft as CollocationPartDrag, g as TextStyleOptions, gt as CollocationRenderMember, h as StyleOptions, ht as CollocationRender, i as IconResource, in as PinPresentationPatch, it as CollocationMemberIcon, j as PointSymbolConnector, jt as Marker, k as PointSymbolCapability, kt as stableCollocation, l as MapEvent, ln as PinRender, lt as CollocationMemberSupport, m as PixelCoordinate, mn as resolvePinPresentation, mt as CollocationPointSymbol, n as HandleStyle, nn as PinPresentation, nt as CollocationMemberCapabilities, o as LayerId, on as PinPresentationStatus, ot as CollocationMemberOptions, p as PickOptions, pn as pinZoomScale, pt as CollocationPlate, q as CollocationBracketPlacement, qt as PickModifiers, r as IconHitLine, rn as PinPresentationCapability, rt as CollocationMemberGraphic, s as MapAdapter, sn as PinPresentationStatusEvent, st as CollocationMemberRender, t as FeatureGroup, tn as PinOverridePatch, tt as CollocationMember, u as MapEventHandler, un as combinePinScale, ut as CollocationOptions, v as HatchPattern, vt as CollocationStyle, w as makeFillPatternImage, wt as isCollocation, x as fillPatternImageDimension, xt as cloneCollocation, y as MINE_PATTERN_TILE_SIZE, yt as ResolvedCollocationMemberRender, z as PointSymbolStyle, zt as composeMarkerCapabilities } from "./map-adapter-CTbZTAL0.mjs";
2
2
  import { AmplifierPlacement, AmplifierPlacements, ControlMeasure, ControlMeasureKind, ControlMeasureRender, ControlMeasureStyle, HighlightAppearance, LabelFit, SymbolColors, TextAmplifiers } from "@orbat-mapper/control-measures";
3
3
  import { Feature, Position } from "geojson";
4
4
 
@@ -80,6 +80,8 @@ declare abstract class BaseMapAdapter<TLayerHandle, TEventToken, TViewToken> imp
80
80
  protected destroyEngineResources(): void;
81
81
  protected applyIconResources(resources: readonly IconResource[]): void;
82
82
  protected getIconResource(id: string): IconResource | undefined;
83
+ /** The groups layer `layerId` draws: the ones last passed to `applyFeatureGroups`. */
84
+ protected getFeatureGroups(layerId: LayerId): readonly FeatureGroup[];
83
85
  protected getFeatureGroupOrder(layerId: LayerId, featureId: string | number | undefined): number | undefined;
84
86
  protected removeIconResource(id: string): void;
85
87
  private pruneIconResources;
@@ -942,7 +944,8 @@ interface ResolvedCollocationOptions {
942
944
  mark: MemberMark | "none";
943
945
  color: string;
944
946
  size: number;
945
- };
947
+ }; /** The location and member position marks shrink with the collocation scale. */
948
+ scaleMarks: boolean;
946
949
  ties: ResolvedCollocationStroke & {
947
950
  show: boolean;
948
951
  };
@@ -1115,7 +1118,10 @@ interface CollocationGroundMark<M extends string> {
1115
1118
  position: Position;
1116
1119
  mark: M;
1117
1120
  color: string;
1118
- /** Diameter in CSS px, shrinking with the collocation scale. */
1121
+ /**
1122
+ * Diameter in CSS px, shrinking with the collocation scale unless
1123
+ * `ground.scaleMarks` is `false`.
1124
+ */
1119
1125
  size: number;
1120
1126
  /** Stroke width of rings and crosses: `line.strokeWidth`, scaled like {@link size}. */
1121
1127
  strokeWidth: number;
package/dist/index.mjs CHANGED
@@ -853,6 +853,10 @@ var BaseMapAdapter = class {
853
853
  getIconResource(id) {
854
854
  return this.iconResources.get(id);
855
855
  }
856
+ /** The groups layer `layerId` draws: the ones last passed to `applyFeatureGroups`. */
857
+ getFeatureGroups(layerId) {
858
+ return this.featureGroupState.get(layerId)?.groups ?? [];
859
+ }
856
860
  getFeatureGroupOrder(layerId, featureId) {
857
861
  if (featureId === void 0) return void 0;
858
862
  return this.featureGroupState.get(layerId)?.orderByFeatureId.get(featureId);
@@ -3378,6 +3382,7 @@ const COLLOCATION_OPTIONS_SCHEMA = {
3378
3382
  color: color$1,
3379
3383
  size: positive$1
3380
3384
  } },
3385
+ scaleMarks: boolean,
3381
3386
  ties: stroke(positive$1),
3382
3387
  spread: { fields: {
3383
3388
  shape: oneOf$1("none", "hull", "concave", "circle", "box"),
@@ -14260,6 +14265,7 @@ function resolveCollocationOptions(options = {}) {
14260
14265
  color: memberColor,
14261
14266
  size: positive(ground.memberPositions?.size, memberMark === "none" ? 0 : MARK_SIZES[memberMark])
14262
14267
  },
14268
+ scaleMarks: ground.scaleMarks !== false,
14263
14269
  ties: {
14264
14270
  show: ties.show === true,
14265
14271
  strokeColor: color(ties.strokeColor, memberColor),
@@ -14930,7 +14936,8 @@ function layoutCollocation(collocationRender, resolution) {
14930
14936
  }
14931
14937
  /**
14932
14938
  * `marked`: a Staff foot or leader already ends at the location, so `"auto"`
14933
- * draws no mark. The marks shrink with the collocation scale `s`.
14939
+ * draws no mark. The marks shrink with the collocation scale `s` unless
14940
+ * `ground.scaleMarks` is `false`.
14934
14941
  */
14935
14942
  function groundMarks(collocation, o, location, marked, s) {
14936
14943
  const positioned = collocation.members.flatMap((member) => {
@@ -14942,13 +14949,14 @@ function groundMarks(collocation, o, location, marked, s) {
14942
14949
  position: [nearestWorldCopyLng(position[0], location[0]), position[1]]
14943
14950
  }];
14944
14951
  });
14945
- /** A mark `size` px across at full size, shrunk with the collocation. */
14952
+ const k = o.ground.scaleMarks ? s : 1;
14953
+ /** A mark `size` px across at full size, shrunk with the collocation unless kept at full size. */
14946
14954
  const scaledMark = (mark, color, size) => ({
14947
14955
  mark,
14948
14956
  color,
14949
- size: size * s,
14950
- strokeWidth: o.line.strokeWidth * s,
14951
- paths: markPaths(mark, size * s)
14957
+ size: size * k,
14958
+ strokeWidth: o.line.strokeWidth * k,
14959
+ paths: markPaths(mark, size * k)
14952
14960
  });
14953
14961
  const markOptions = o.ground.memberPositions;
14954
14962
  const ties = [];
@@ -15234,10 +15242,12 @@ function renderCollocationGroup(collocation, capabilities, options) {
15234
15242
  * A ground mark, laid out at its full size times the collocation scale: its
15235
15243
  * image is drawn at full size and the engine scales it, natively for a
15236
15244
  * ground size, so zooming mints no new image and its Highlight casing
15237
- * shrinks with it.
15245
+ * shrinks with it. Under `ground.scaleMarks: false` it is laid out, and
15246
+ * drawn, at its full size.
15238
15247
  */
15248
+ const scaleMarks = layout.options.ground.scaleMarks;
15239
15249
  const markFeature = (featureId, mark, highlighted) => {
15240
- const k = layout.scale;
15250
+ const k = scaleMarks ? layout.scale : 1;
15241
15251
  let full = mark;
15242
15252
  if (k !== 1) {
15243
15253
  const size = snap(mark.size / k);
@@ -15259,7 +15269,7 @@ function renderCollocationGroup(collocation, capabilities, options) {
15259
15269
  iconId: addResource(markResource(full, highlighted ? highlight : void 0)),
15260
15270
  iconScale: k,
15261
15271
  [ICON_SCREEN_ROTATION_PROPERTY]: 0,
15262
- ...native ? groundSizeProperties(native, native.maxPixels) : {}
15272
+ ...native && scaleMarks ? groundSizeProperties(native, native.maxPixels) : {}
15263
15273
  })
15264
15274
  };
15265
15275
  };
@@ -440,6 +440,12 @@ interface CollocationGround {
440
440
  color?: string;
441
441
  size?: number;
442
442
  };
443
+ /**
444
+ * Default `true`: the location and member position marks shrink with the
445
+ * members when a ground size shrinks the collocation below its `maxPixels`.
446
+ * `false` keeps them at their full size.
447
+ */
448
+ scaleMarks?: boolean;
443
449
  /**
444
450
  * Lines from each positioned member to the location. Hidden by default;
445
451
  * `{ show: true }` is 1 px solid in `memberPositions.color`.
@@ -1,4 +1,4 @@
1
- import { m as PixelCoordinate, o as LayerId, s as MapAdapter } from "./map-adapter-De1DC6Zy.mjs";
1
+ import { m as PixelCoordinate, o as LayerId, s as MapAdapter } from "./map-adapter-CTbZTAL0.mjs";
2
2
  import { Feature } from "geojson";
3
3
 
4
4
  //#region src/testing/feature-group-conformance.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw",
3
- "version": "0.35.0",
3
+ "version": "0.36.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",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@orbat-mapper/control-measures": "^0.46.1"
42
+ "@orbat-mapper/control-measures": "^0.47.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "vitest": ">=4.0.0"