@orbat-mapper/tactical-draw 0.9.1 → 0.9.2
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 { A as PinOverridePatch, B as resolvePinPresentation, C as makeFillPatternImage, D as PointerEventInfo, E as PointerCallback, F as PinPresentationStatus, I as PinPresentationStatusEvent, L as PinPresentationStore, M as PinPresentationCapability, N as PinPresentationPatch, O as DEFAULT_PIN_PRESENTATION, P as PinPresentationState, R as PinRender, S as isMinePattern, T as EditPointerDriver, _ as HatchPattern, a as LayerId, b as fillPatternImageDimension, c as MapEvent, d as PickHandler, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, j as PinPresentation, k as PinFootprint, l as MapEventHandler, m as StyleOptions, n as HandleStyle, o as MapAdapter, p as PixelCoordinate, r as IconResource, s as MapCursor, t as FeatureGroup, u as PickEvent, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as isValidPinNumber } from "./map-adapter-
|
|
1
|
+
import { A as PinOverridePatch, B as resolvePinPresentation, C as makeFillPatternImage, D as PointerEventInfo, E as PointerCallback, F as PinPresentationStatus, I as PinPresentationStatusEvent, L as PinPresentationStore, M as PinPresentationCapability, N as PinPresentationPatch, O as DEFAULT_PIN_PRESENTATION, P as PinPresentationState, R as PinRender, S as isMinePattern, T as EditPointerDriver, _ as HatchPattern, a as LayerId, b as fillPatternImageDimension, c as MapEvent, d as PickHandler, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, j as PinPresentation, k as PinFootprint, l as MapEventHandler, m as StyleOptions, n as HandleStyle, o as MapAdapter, p as PixelCoordinate, r as IconResource, s as MapCursor, t as FeatureGroup, u as PickEvent, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as isValidPinNumber } from "./map-adapter-DY-iZRcb.mjs";
|
|
2
2
|
import { AmplifierPlacement, AmplifierPlacements, ControlMeasure, ControlMeasureKind, ControlMeasureRender, ControlMeasureStyle, SymbolColors, TextAmplifiers } from "@orbat-mapper/control-measures";
|
|
3
3
|
import { Feature, Position } from "geojson";
|
|
4
4
|
|
package/dist/index.mjs
CHANGED
|
@@ -1088,7 +1088,11 @@ function createCommitEmitter(listenerErrorsMessage) {
|
|
|
1088
1088
|
//#endregion
|
|
1089
1089
|
//#region src/pin-presentation.ts
|
|
1090
1090
|
function validateOverride(patch) {
|
|
1091
|
-
for (const key of [
|
|
1091
|
+
for (const key of [
|
|
1092
|
+
"mode",
|
|
1093
|
+
"occlusion",
|
|
1094
|
+
"prioritizePins"
|
|
1095
|
+
]) if (Object.hasOwn(patch, key)) throw new TypeError(`Pin setting ${key} is view-wide only`);
|
|
1092
1096
|
}
|
|
1093
1097
|
const DEFAULT_PIN_PRESENTATION = Object.freeze({
|
|
1094
1098
|
enabled: false,
|
|
@@ -1097,6 +1101,7 @@ const DEFAULT_PIN_PRESENTATION = Object.freeze({
|
|
|
1097
1101
|
heightMeters: 250,
|
|
1098
1102
|
sizePixels: 32,
|
|
1099
1103
|
occlusion: "none",
|
|
1104
|
+
prioritizePins: true,
|
|
1100
1105
|
stem: Object.freeze({
|
|
1101
1106
|
color: "#172033",
|
|
1102
1107
|
width: 2,
|
|
@@ -6062,6 +6067,15 @@ function runGroupTransform(opts) {
|
|
|
6062
6067
|
}
|
|
6063
6068
|
return pixels;
|
|
6064
6069
|
}
|
|
6070
|
+
/** An axis-aligned {@link TransformBox} spanning a min/max pixel extent. */
|
|
6071
|
+
function boxFromPixelBounds(min, max) {
|
|
6072
|
+
return {
|
|
6073
|
+
center: [(min[0] + max[0]) / 2, (min[1] + max[1]) / 2],
|
|
6074
|
+
halfWidth: (max[0] - min[0]) / 2,
|
|
6075
|
+
halfHeight: (max[1] - min[1]) / 2,
|
|
6076
|
+
angle: 0
|
|
6077
|
+
};
|
|
6078
|
+
}
|
|
6065
6079
|
/** The rotated-text footprint corners for a Text member's rendered feature, or `null`. */
|
|
6066
6080
|
function textFootprintCorners(features) {
|
|
6067
6081
|
const box = fitTextFootprintFromFeatures(features, driver.toPixel, {
|
|
@@ -6127,6 +6141,7 @@ function runGroupTransform(opts) {
|
|
|
6127
6141
|
let features;
|
|
6128
6142
|
let iconResources = [];
|
|
6129
6143
|
let imageOverlays;
|
|
6144
|
+
let pinGroup;
|
|
6130
6145
|
let boxPixels = [];
|
|
6131
6146
|
if (isImageMember(member)) {
|
|
6132
6147
|
const image = buildWorkingImage(member);
|
|
@@ -6138,11 +6153,23 @@ function runGroupTransform(opts) {
|
|
|
6138
6153
|
} else try {
|
|
6139
6154
|
if (isPointSymbolMember(member)) {
|
|
6140
6155
|
const symbol = buildWorkingPointSymbol(member);
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6156
|
+
pinGroup = opts.renderPin?.(symbol);
|
|
6157
|
+
if (pinGroup?.pin) {
|
|
6158
|
+
features = pinGroup.features;
|
|
6159
|
+
iconResources = pinGroup.iconResources;
|
|
6160
|
+
const pinFootprint = adapter.getPinFootprint?.(symbol.id);
|
|
6161
|
+
if (pinFootprint) boxPixels = boxCorners(boxFromPixelBounds(pinFootprint.min, pinFootprint.max));
|
|
6162
|
+
else {
|
|
6163
|
+
const footprint = pointSymbolFootprint(symbol, renderPointSymbolForAdapter(adapter, capability, symbol).render, adapter);
|
|
6164
|
+
if (footprint) boxPixels = footprint.corners;
|
|
6165
|
+
}
|
|
6166
|
+
} else {
|
|
6167
|
+
const plan = renderPointSymbolForAdapter(adapter, capability, symbol);
|
|
6168
|
+
iconResources = [plan.resource];
|
|
6169
|
+
features = plan.features;
|
|
6170
|
+
const footprint = pointSymbolFootprint(symbol, plan.render, adapter);
|
|
6171
|
+
if (footprint) boxPixels = footprint.corners;
|
|
6172
|
+
}
|
|
6146
6173
|
} else {
|
|
6147
6174
|
const working = workingGraphicFor(i);
|
|
6148
6175
|
features = renderMeasureForAdapter(adapter, working, renderOpts).features;
|
|
@@ -6153,16 +6180,11 @@ function runGroupTransform(opts) {
|
|
|
6153
6180
|
boxPixels = [];
|
|
6154
6181
|
}
|
|
6155
6182
|
member.lastBoxPixels = boxPixels;
|
|
6156
|
-
|
|
6157
|
-
id: member.graphic.id,
|
|
6158
|
-
features,
|
|
6159
|
-
iconResources,
|
|
6160
|
-
...imageOverlays ? { imageOverlays } : {}
|
|
6161
|
-
});
|
|
6162
|
-
else previewGroups.push({
|
|
6183
|
+
(member.usesGraphicStack ? workingGroups : previewGroups).push({
|
|
6163
6184
|
id: member.graphic.id,
|
|
6164
6185
|
features,
|
|
6165
6186
|
iconResources,
|
|
6187
|
+
...pinGroup?.pin ? { pin: pinGroup.pin } : {},
|
|
6166
6188
|
...imageOverlays ? { imageOverlays } : {}
|
|
6167
6189
|
});
|
|
6168
6190
|
});
|
|
@@ -8485,6 +8507,7 @@ var TacticalDraw = class {
|
|
|
8485
8507
|
adapter: this.adapter,
|
|
8486
8508
|
capability: this.pointSymbols,
|
|
8487
8509
|
imageCapability: this.images,
|
|
8510
|
+
...this.pointSymbols ? { renderPin: (symbol) => this.buildGraphicGroup(symbol) } : {},
|
|
8488
8511
|
graphics: measures,
|
|
8489
8512
|
graphicsLayer: this.graphicsLayer,
|
|
8490
8513
|
previewLayer: this.previewLayer,
|
|
@@ -10,6 +10,7 @@ interface PinPresentation {
|
|
|
10
10
|
heightMeters: number;
|
|
11
11
|
sizePixels: number;
|
|
12
12
|
occlusion: "none" | "terrain";
|
|
13
|
+
prioritizePins: boolean;
|
|
13
14
|
stem: {
|
|
14
15
|
color: string;
|
|
15
16
|
width: number;
|
|
@@ -48,7 +49,7 @@ type PinPresentationPatch = Partial<Omit<PinPresentation, "stem" | "dot" | "halo
|
|
|
48
49
|
plate?: Partial<PinPresentation["plate"]>;
|
|
49
50
|
};
|
|
50
51
|
/** Per-unit appearance and dimensions; spatial rules belong to the view. */
|
|
51
|
-
type PinOverridePatch = Omit<PinPresentationPatch, "mode" | "occlusion">;
|
|
52
|
+
type PinOverridePatch = Omit<PinPresentationPatch, "mode" | "occlusion" | "prioritizePins">;
|
|
52
53
|
interface PinPresentationState {
|
|
53
54
|
defaults: PinPresentationPatch;
|
|
54
55
|
overrides: Record<string, PinOverridePatch>;
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as LayerId, o as MapAdapter, p as PixelCoordinate } from "./map-adapter-
|
|
1
|
+
import { a as LayerId, o as MapAdapter, p as PixelCoordinate } from "./map-adapter-DY-iZRcb.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.9.
|
|
3
|
+
"version": "0.9.2",
|
|
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",
|