@orbat-mapper/tactical-draw 0.36.2 → 0.37.0
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 +16 -1
- package/dist/index.mjs +113 -45
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -246,6 +246,12 @@ interface PickCandidateInput {
|
|
|
246
246
|
/** The engine already reported this part as hit; retained as a fallback for engine-only marks. */
|
|
247
247
|
nativeHit?: boolean;
|
|
248
248
|
icon?: IconResource;
|
|
249
|
+
/**
|
|
250
|
+
* The scale `icon` is drawn at, when the engine sizes it itself rather than
|
|
251
|
+
* from the feature's `iconScale` snapshot: a ground-sized icon on an engine
|
|
252
|
+
* that scales those natively (`MapAdapter.scalesGroundPointSymbolsNatively`).
|
|
253
|
+
*/
|
|
254
|
+
iconScale?: number;
|
|
249
255
|
labelExtent?: LabelExtent;
|
|
250
256
|
presentation?: ResolvedPickPresentation;
|
|
251
257
|
layerStyle?: StyleOptions;
|
|
@@ -1788,7 +1794,10 @@ interface CollocationGroupRender {
|
|
|
1788
1794
|
* resolution re-render of a ground-sized collocation mints no new image. When
|
|
1789
1795
|
* its size has a `maxPixels` cap, every icon feature also carries the native
|
|
1790
1796
|
* ground-size fields, so an engine that scales ground-sized point symbols
|
|
1791
|
-
* natively tracks zoom animations itself.
|
|
1797
|
+
* natively tracks zoom animations itself. For such an engine
|
|
1798
|
+
* (`nativeGroundScaling`) those icons leave out the `iconScale` snapshot, so a
|
|
1799
|
+
* zoom that changes no image re-renders identical features and the engine
|
|
1800
|
+
* reloads nothing mid-animation (#791).
|
|
1792
1801
|
*/
|
|
1793
1802
|
declare function renderCollocationGroup(collocation: Collocation, capabilities: CollocationMemberCapabilities, options: {
|
|
1794
1803
|
resolution: number | undefined;
|
|
@@ -1806,6 +1815,12 @@ declare function renderCollocationGroup(collocation: Collocation, capabilities:
|
|
|
1806
1815
|
* still draw.
|
|
1807
1816
|
*/
|
|
1808
1817
|
hiddenMembers?: readonly string[];
|
|
1818
|
+
/**
|
|
1819
|
+
* The engine sizes ground-sized icons from their native fields
|
|
1820
|
+
* (`MapAdapter.scalesGroundPointSymbolsNatively`): icons that carry them
|
|
1821
|
+
* get no per-resolution `iconScale`.
|
|
1822
|
+
*/
|
|
1823
|
+
nativeGroundScaling?: boolean;
|
|
1809
1824
|
}): CollocationGroupRender;
|
|
1810
1825
|
/** The view a live leader is drawn through. */
|
|
1811
1826
|
interface LiveLeaderView {
|
package/dist/index.mjs
CHANGED
|
@@ -312,7 +312,7 @@ function evaluateInput(input, presentation, context) {
|
|
|
312
312
|
kind: "label",
|
|
313
313
|
distance: 0
|
|
314
314
|
} };
|
|
315
|
-
if (input.icon) return evaluateIcon(input.feature, input.icon, context);
|
|
315
|
+
if (input.icon) return evaluateIcon(input.feature, input.icon, context, input.iconScale);
|
|
316
316
|
const geometryHit = evaluateGeometry(input.feature, presentation, context);
|
|
317
317
|
if (geometryHit) return { hit: geometryHit };
|
|
318
318
|
if (input.feature.geometry.type === "Polygon" || input.feature.geometry.type === "MultiPolygon") return null;
|
|
@@ -381,11 +381,11 @@ function bestPolygonHit(hits) {
|
|
|
381
381
|
if (boundary.length > 0) return boundary.reduce((best, hit) => (hit.distance ?? Infinity) < (best.distance ?? Infinity) ? hit : best);
|
|
382
382
|
return hits[0];
|
|
383
383
|
}
|
|
384
|
-
function evaluateIcon(feature, resource, context) {
|
|
384
|
+
function evaluateIcon(feature, resource, context, iconScale) {
|
|
385
385
|
if (feature.geometry.type !== "Point") return null;
|
|
386
386
|
const anchor = context.toPixel(feature.geometry.coordinates);
|
|
387
387
|
if (!anchor) return null;
|
|
388
|
-
const rawScale = feature.properties?.iconScale;
|
|
388
|
+
const rawScale = iconScale ?? feature.properties?.iconScale;
|
|
389
389
|
const scale = typeof rawScale === "number" ? rawScale : 1;
|
|
390
390
|
if (!Number.isFinite(scale) || scale <= 0) return null;
|
|
391
391
|
const rawRotation = feature.properties?.iconRotation;
|
|
@@ -6184,26 +6184,17 @@ function normalizeAngle(angle) {
|
|
|
6184
6184
|
* that no adapter is drawing.
|
|
6185
6185
|
*/
|
|
6186
6186
|
function fitLabelTransformBox(input) {
|
|
6187
|
-
const { text,
|
|
6187
|
+
const { text, textAnchor, anchor } = input;
|
|
6188
6188
|
if (!text) return null;
|
|
6189
|
-
const angle =
|
|
6190
|
-
|
|
6191
|
-
if (
|
|
6192
|
-
const appearance = resolveTextAppearance({
|
|
6193
|
-
textSizePixels,
|
|
6194
|
-
textSizeMeters,
|
|
6195
|
-
textMaxSizePixels: unclamped ? textMaxSizePixels ?? Infinity : textMaxSizePixels,
|
|
6196
|
-
...labelSizeBand
|
|
6197
|
-
}, resolution ?? 0);
|
|
6198
|
-
if (!appearance) return null;
|
|
6199
|
-
h = Math.max(1, appearance.sizePixels);
|
|
6200
|
-
}
|
|
6189
|
+
const angle = labelScreenAngle(input);
|
|
6190
|
+
const h = labelTextSizePixels(input);
|
|
6191
|
+
if (h === null) return null;
|
|
6201
6192
|
const lines = text.split("\n");
|
|
6202
6193
|
const width = lines.reduce((max, line) => Math.max(max, line.length), 0) * CHAR_WIDTH_FACTOR * h;
|
|
6203
6194
|
const height = lines.length * LINE_HEIGHT_FACTOR * h;
|
|
6204
6195
|
const halfWidth = width / 2 + 4;
|
|
6205
6196
|
const halfHeight = height / 2 + 4;
|
|
6206
|
-
const [offsetRight, offsetDown] = textOffsetEms ?? [0, 0];
|
|
6197
|
+
const [offsetRight, offsetDown] = input.textOffsetEms ?? [0, 0];
|
|
6207
6198
|
const localX = (textAnchor === "start" ? width / 2 : textAnchor === "end" ? -width / 2 : 0) + offsetRight * h;
|
|
6208
6199
|
const localY = offsetDown * h;
|
|
6209
6200
|
let center = anchor;
|
|
@@ -6218,6 +6209,38 @@ function fitLabelTransformBox(input) {
|
|
|
6218
6209
|
angle
|
|
6219
6210
|
};
|
|
6220
6211
|
}
|
|
6212
|
+
/** The on-screen angle a label's text is drawn at, radians, y-down. */
|
|
6213
|
+
function labelScreenAngle({ rotation, bearing }) {
|
|
6214
|
+
return normalizeAngle(Math.PI - (rotation ?? 0) - (bearing ?? 0));
|
|
6215
|
+
}
|
|
6216
|
+
/**
|
|
6217
|
+
* The text's on-screen offset from its point, pixels: `textOffsetEms` times
|
|
6218
|
+
* the rendered size, turned with the text. `[0, 0]` without an offset,
|
|
6219
|
+
* `null` while the label is hidden.
|
|
6220
|
+
*/
|
|
6221
|
+
function labelTextOffsetPixels(input) {
|
|
6222
|
+
const [offsetRight, offsetDown] = input.textOffsetEms ?? [0, 0];
|
|
6223
|
+
if (offsetRight === 0 && offsetDown === 0) return [0, 0];
|
|
6224
|
+
const h = labelTextSizePixels(input);
|
|
6225
|
+
if (h === null) return null;
|
|
6226
|
+
return rotate(offsetRight * h, offsetDown * h, labelScreenAngle(input));
|
|
6227
|
+
}
|
|
6228
|
+
/** The label's rendered text size in pixels, or `null` while it is hidden. */
|
|
6229
|
+
function labelTextSizePixels(input) {
|
|
6230
|
+
const { textSizePixels, textSizeMeters, resolution, unclamped, textMaxSizePixels, labelSizeBand } = input;
|
|
6231
|
+
let h = 16;
|
|
6232
|
+
if (textSizePixels !== void 0 || textSizeMeters !== void 0 && resolution !== void 0 && resolution > 0) {
|
|
6233
|
+
const appearance = resolveTextAppearance({
|
|
6234
|
+
textSizePixels,
|
|
6235
|
+
textSizeMeters,
|
|
6236
|
+
textMaxSizePixels: unclamped ? textMaxSizePixels ?? Infinity : textMaxSizePixels,
|
|
6237
|
+
...labelSizeBand
|
|
6238
|
+
}, resolution ?? 0);
|
|
6239
|
+
if (!appearance) return null;
|
|
6240
|
+
h = Math.max(1, appearance.sizePixels);
|
|
6241
|
+
}
|
|
6242
|
+
return h;
|
|
6243
|
+
}
|
|
6221
6244
|
/**
|
|
6222
6245
|
* Read a label `Point` feature's rendered props (`text`, `rotation`,
|
|
6223
6246
|
* `textAnchor`, `textSizePixels`, `textSizeMeters`) into a
|
|
@@ -6228,8 +6251,12 @@ function fitLabelTransformBox(input) {
|
|
|
6228
6251
|
* click-away check matches what the edit controller would pick.
|
|
6229
6252
|
*/
|
|
6230
6253
|
function fitLabelBoxFromFeature(feature, anchorPixel, view) {
|
|
6254
|
+
return fitLabelTransformBox(labelBoxInputFromFeature(feature, anchorPixel, view));
|
|
6255
|
+
}
|
|
6256
|
+
/** A label feature's rendered props as a {@link fitLabelTransformBox} input. */
|
|
6257
|
+
function labelBoxInputFromFeature(feature, anchorPixel, view) {
|
|
6231
6258
|
const props = feature.properties ?? {};
|
|
6232
|
-
return
|
|
6259
|
+
return {
|
|
6233
6260
|
text: typeof props.text === "string" ? props.text : void 0,
|
|
6234
6261
|
rotation: typeof props.rotation === "number" ? props.rotation : void 0,
|
|
6235
6262
|
textAnchor: props.textAnchor === "start" || props.textAnchor === "end" ? props.textAnchor : void 0,
|
|
@@ -6242,7 +6269,7 @@ function fitLabelBoxFromFeature(feature, anchorPixel, view) {
|
|
|
6242
6269
|
bearing: view.bearing,
|
|
6243
6270
|
unclamped: view.unclamped,
|
|
6244
6271
|
labelSizeBand: view.labelSizeBand
|
|
6245
|
-
}
|
|
6272
|
+
};
|
|
6246
6273
|
}
|
|
6247
6274
|
/**
|
|
6248
6275
|
* Fit a `TransformBox` around a rendered **Text generic graphic** feature — the
|
|
@@ -6413,17 +6440,18 @@ function createLabelPlacement(deps) {
|
|
|
6413
6440
|
if (typeof key !== "string" || feature.geometry?.type !== "Point") continue;
|
|
6414
6441
|
const projected = projection.toPixel(feature.geometry.coordinates);
|
|
6415
6442
|
if (!projected) continue;
|
|
6443
|
+
const origin = placedTextPixel(feature, projected) ?? projected;
|
|
6416
6444
|
for (const handle of [false, true]) {
|
|
6417
|
-
const targetY =
|
|
6418
|
-
if (Math.hypot(
|
|
6445
|
+
const targetY = origin[1] - (handle ? LABEL_HANDLE_OFFSET_PX : 0);
|
|
6446
|
+
if (Math.hypot(origin[0] - pixel[0], targetY - pixel[1]) <= tolerance) return {
|
|
6419
6447
|
key,
|
|
6420
|
-
anchorPixel:
|
|
6448
|
+
anchorPixel: origin
|
|
6421
6449
|
};
|
|
6422
6450
|
}
|
|
6423
6451
|
const box = fitLabelBoxFromFeature(feature, projected, view());
|
|
6424
6452
|
if (box && pointInBox(box, pixel)) return {
|
|
6425
6453
|
key,
|
|
6426
|
-
anchorPixel:
|
|
6454
|
+
anchorPixel: origin
|
|
6427
6455
|
};
|
|
6428
6456
|
}
|
|
6429
6457
|
return null;
|
|
@@ -6454,6 +6482,20 @@ function createLabelPlacement(deps) {
|
|
|
6454
6482
|
pixel
|
|
6455
6483
|
};
|
|
6456
6484
|
}
|
|
6485
|
+
/**
|
|
6486
|
+
* Where the text of a label whose offset lapses once placed
|
|
6487
|
+
* (`textOffsetUntilPlaced`, ADR-0068) is drawn, for a label whose point is
|
|
6488
|
+
* at `pixel`; `undefined` for any other label, or one already placed. Once
|
|
6489
|
+
* placed it sits on its stored point without the offset, so a gesture
|
|
6490
|
+
* moves and stores this pixel instead of the point, and the text stays
|
|
6491
|
+
* under the pointer when the offset lapses.
|
|
6492
|
+
*/
|
|
6493
|
+
function placedTextPixel(feature, pixel) {
|
|
6494
|
+
if (feature.properties?.textOffsetUntilPlaced !== true) return void 0;
|
|
6495
|
+
const offset = labelTextOffsetPixels(labelBoxInputFromFeature(feature, pixel, view()));
|
|
6496
|
+
if (!offset || offset[0] === 0 && offset[1] === 0) return void 0;
|
|
6497
|
+
return [pixel[0] + offset[0], pixel[1] + offset[1]];
|
|
6498
|
+
}
|
|
6457
6499
|
/** The screen-space angle (radians, y-down) from `anchor` to `pixel`, as used by the label rotate drag's pointer-angle math. */
|
|
6458
6500
|
function pointerAngleAround(pixel, anchor) {
|
|
6459
6501
|
return Math.atan2(pixel[1] - anchor[1], pixel[0] - anchor[0]);
|
|
@@ -6473,8 +6515,9 @@ function createLabelPlacement(deps) {
|
|
|
6473
6515
|
const key = feature.properties?.labelPlacementKey;
|
|
6474
6516
|
if (typeof key !== "string" || feature.geometry?.type !== "Point") continue;
|
|
6475
6517
|
if (key === selectedLabelKey) continue;
|
|
6476
|
-
const
|
|
6477
|
-
if (!
|
|
6518
|
+
const projected = projection.toPixel(feature.geometry.coordinates);
|
|
6519
|
+
if (!projected) continue;
|
|
6520
|
+
const pixel = placedTextPixel(feature, projected) ?? projected;
|
|
6478
6521
|
features_.push({
|
|
6479
6522
|
type: "Feature",
|
|
6480
6523
|
id: `${handleIdPrefix}:label-handle:${index}`,
|
|
@@ -6506,19 +6549,22 @@ function createLabelPlacement(deps) {
|
|
|
6506
6549
|
if (labelBox) {
|
|
6507
6550
|
const anchor = selectedLabelAnchor();
|
|
6508
6551
|
if (anchor) {
|
|
6552
|
+
const placedText = placedTextPixel(anchor.feature, anchor.pixel);
|
|
6553
|
+
const origin = placedText ?? anchor.pixel;
|
|
6509
6554
|
const gripPixel = rotateGripPixel(labelBox, 14);
|
|
6510
6555
|
if (Math.hypot(gripPixel[0] - pixel[0], gripPixel[1] - pixel[1]) <= tolerance) {
|
|
6511
6556
|
const props = anchor.feature.properties ?? {};
|
|
6512
6557
|
activeLabelRotateDrag = {
|
|
6513
6558
|
key: selectedLabelKey,
|
|
6514
|
-
anchorPixel:
|
|
6515
|
-
|
|
6559
|
+
anchorPixel: origin,
|
|
6560
|
+
position: placedText && projection.fromPixel(placedText),
|
|
6561
|
+
startPointerAngle: pointerAngleAround(pixel, origin),
|
|
6516
6562
|
startRotation: typeof props.rotation === "number" ? props.rotation : 0,
|
|
6517
6563
|
previous: snapshotAmplifierPlacements(),
|
|
6518
6564
|
downPixel: pixel,
|
|
6519
6565
|
text: typeof props.text === "string" ? props.text : void 0,
|
|
6520
6566
|
textAnchor: props.textAnchor === "start" || props.textAnchor === "end" ? props.textAnchor : void 0,
|
|
6521
|
-
textOffsetEms: labelTextOffsetEms(props),
|
|
6567
|
+
textOffsetEms: placedText ? void 0 : labelTextOffsetEms(props),
|
|
6522
6568
|
textSizePixels: typeof props.textSizePixels === "number" ? props.textSizePixels : void 0,
|
|
6523
6569
|
textSizeMeters: typeof props.textSizeMeters === "number" ? props.textSizeMeters : void 0,
|
|
6524
6570
|
lastBox: labelBox
|
|
@@ -6528,7 +6574,7 @@ function createLabelPlacement(deps) {
|
|
|
6528
6574
|
if (pointInBox(labelBox, pixel)) {
|
|
6529
6575
|
activeAmplifierDrag = {
|
|
6530
6576
|
field: selectedLabelKey,
|
|
6531
|
-
grabOffset: [
|
|
6577
|
+
grabOffset: [origin[0] - pixel[0], origin[1] - pixel[1]],
|
|
6532
6578
|
previous: snapshotAmplifierPlacements(),
|
|
6533
6579
|
downPixel: pixel
|
|
6534
6580
|
};
|
|
@@ -6548,6 +6594,13 @@ function createLabelPlacement(deps) {
|
|
|
6548
6594
|
}
|
|
6549
6595
|
return false;
|
|
6550
6596
|
}
|
|
6597
|
+
/** A rotate drag's placement: the rotation, plus its `position` when it has one. */
|
|
6598
|
+
function rotatedPlacement(drag, rotation) {
|
|
6599
|
+
return drag.position ? {
|
|
6600
|
+
position: drag.position,
|
|
6601
|
+
rotation
|
|
6602
|
+
} : { rotation };
|
|
6603
|
+
}
|
|
6551
6604
|
function onMove(pixel) {
|
|
6552
6605
|
if (activeLabelRotateDrag) {
|
|
6553
6606
|
const drag = activeLabelRotateDrag;
|
|
@@ -6569,7 +6622,7 @@ function createLabelPlacement(deps) {
|
|
|
6569
6622
|
if (liveBox) drag.lastBox = liveBox;
|
|
6570
6623
|
return {
|
|
6571
6624
|
field: drag.key,
|
|
6572
|
-
value:
|
|
6625
|
+
value: rotatedPlacement(drag, rotation)
|
|
6573
6626
|
};
|
|
6574
6627
|
}
|
|
6575
6628
|
if (activeAmplifierDrag) {
|
|
@@ -6592,7 +6645,7 @@ function createLabelPlacement(deps) {
|
|
|
6592
6645
|
return {
|
|
6593
6646
|
kind: "rotate",
|
|
6594
6647
|
key: drag.key,
|
|
6595
|
-
rotation,
|
|
6648
|
+
value: rotatedPlacement(drag, rotation),
|
|
6596
6649
|
previous: drag.previous
|
|
6597
6650
|
};
|
|
6598
6651
|
}
|
|
@@ -7922,7 +7975,7 @@ function runEdit(opts) {
|
|
|
7922
7975
|
if (labelOutcome) {
|
|
7923
7976
|
workingAmplifierPlacements = labelOutcome.previous;
|
|
7924
7977
|
endDragBookkeeping();
|
|
7925
|
-
if (labelOutcome.kind === "rotate") setAmplifierPlacements({ [labelOutcome.key]:
|
|
7978
|
+
if (labelOutcome.kind === "rotate") setAmplifierPlacements({ [labelOutcome.key]: labelOutcome.value }, "gesture", "Rotate label");
|
|
7926
7979
|
else if (labelOutcome.kind === "move") setAmplifierPlacements({ [labelOutcome.field]: labelOutcome.position }, "gesture", "Move label");
|
|
7927
7980
|
else {
|
|
7928
7981
|
renderWorkingGraphic();
|
|
@@ -11655,6 +11708,10 @@ let nextGraphicGroupRevision = 0;
|
|
|
11655
11708
|
function sameFeatures(a, b) {
|
|
11656
11709
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
11657
11710
|
}
|
|
11711
|
+
/** Icon resource ids hash their drawing, so equal ids in order mean equal resources. */
|
|
11712
|
+
function sameIconResourceIds(a, b) {
|
|
11713
|
+
return a.length === b.length && a.every((resource, i) => resource.id === b[i].id);
|
|
11714
|
+
}
|
|
11658
11715
|
/**
|
|
11659
11716
|
* `TacticalDraw` façade — slice #6 (issue #45).
|
|
11660
11717
|
*
|
|
@@ -12013,7 +12070,11 @@ var TacticalDraw = class {
|
|
|
12013
12070
|
const dependence = presentation && this.graphicUsesPinPresentation(graphic, presentation) ? "none" : graphicViewDependence(graphic, this.adapter.scalesGroundPointSymbolsNatively === true, this.collocationMembers, this.collocations);
|
|
12014
12071
|
const resolution = dependence === "none" ? void 0 : this.adapter.getResolution();
|
|
12015
12072
|
if (isCollocation(graphic)) {
|
|
12016
|
-
const { group, layout } = this.buildCollocationGroup(graphic);
|
|
12073
|
+
const { group: built, layout } = this.buildCollocationGroup(graphic);
|
|
12074
|
+
const group = cached && sameFeatures(cached.group.features, built.features) && sameIconResourceIds(cached.group.iconResources, built.iconResources) ? {
|
|
12075
|
+
...built,
|
|
12076
|
+
revision: cached.group.revision
|
|
12077
|
+
} : built;
|
|
12017
12078
|
this.graphicGroupCache.set(graphic, {
|
|
12018
12079
|
group,
|
|
12019
12080
|
dependence,
|
|
@@ -12071,7 +12132,8 @@ var TacticalDraw = class {
|
|
|
12071
12132
|
collocations.warn(graphic, capabilities);
|
|
12072
12133
|
const drawn = collocations.renderGroup(graphic, capabilities, {
|
|
12073
12134
|
resolution: this.adapter.getResolution(),
|
|
12074
|
-
highlight: this.sessionRenderOptions.highlightAppearance
|
|
12135
|
+
highlight: this.sessionRenderOptions.highlightAppearance,
|
|
12136
|
+
nativeGroundScaling: this.adapter.scalesGroundPointSymbolsNatively === true
|
|
12075
12137
|
});
|
|
12076
12138
|
return {
|
|
12077
12139
|
group: {
|
|
@@ -15213,7 +15275,10 @@ const COLLOCATION_MEMBER_PROPERTY = "collocationMemberId";
|
|
|
15213
15275
|
* resolution re-render of a ground-sized collocation mints no new image. When
|
|
15214
15276
|
* its size has a `maxPixels` cap, every icon feature also carries the native
|
|
15215
15277
|
* ground-size fields, so an engine that scales ground-sized point symbols
|
|
15216
|
-
* natively tracks zoom animations itself.
|
|
15278
|
+
* natively tracks zoom animations itself. For such an engine
|
|
15279
|
+
* (`nativeGroundScaling`) those icons leave out the `iconScale` snapshot, so a
|
|
15280
|
+
* zoom that changes no image re-renders identical features and the engine
|
|
15281
|
+
* reloads nothing mid-animation (#791).
|
|
15217
15282
|
*/
|
|
15218
15283
|
function renderCollocationGroup(collocation, capabilities, options) {
|
|
15219
15284
|
const hiddenIds = new Set(options.hiddenMembers);
|
|
@@ -15238,6 +15303,11 @@ function renderCollocationGroup(collocation, capabilities, options) {
|
|
|
15238
15303
|
return resource.id;
|
|
15239
15304
|
};
|
|
15240
15305
|
const native = nativeGroundSizing(render.size);
|
|
15306
|
+
/** An icon's size: its native ground-size fields, plus the `iconScale` snapshot unless the engine needs none. */
|
|
15307
|
+
const iconSize = (iconScale, octagonSize) => native && octagonSize !== void 0 ? {
|
|
15308
|
+
...options.nativeGroundScaling ? {} : { iconScale },
|
|
15309
|
+
...groundSizeProperties(native, octagonSize)
|
|
15310
|
+
} : { iconScale };
|
|
15241
15311
|
/**
|
|
15242
15312
|
* A ground mark, laid out at its full size times the collocation scale: its
|
|
15243
15313
|
* image is drawn at full size and the engine scales it, natively for a
|
|
@@ -15267,9 +15337,8 @@ function renderCollocationGroup(collocation, capabilities, options) {
|
|
|
15267
15337
|
},
|
|
15268
15338
|
properties: ground({
|
|
15269
15339
|
iconId: addResource(markResource(full, highlighted ? highlight : void 0)),
|
|
15270
|
-
|
|
15271
|
-
[ICON_SCREEN_ROTATION_PROPERTY]: 0
|
|
15272
|
-
...native && scaleMarks ? groundSizeProperties(native, native.maxPixels) : {}
|
|
15340
|
+
...iconSize(k, scaleMarks ? native?.maxPixels : void 0),
|
|
15341
|
+
[ICON_SCREEN_ROTATION_PROPERTY]: 0
|
|
15273
15342
|
})
|
|
15274
15343
|
};
|
|
15275
15344
|
};
|
|
@@ -15390,10 +15459,9 @@ function renderCollocationGroup(collocation, capabilities, options) {
|
|
|
15390
15459
|
properties: base({
|
|
15391
15460
|
[COLLOCATION_PART_PROPERTY]: part.part,
|
|
15392
15461
|
iconId: addResource(resource),
|
|
15393
|
-
|
|
15462
|
+
...iconSize(layout.scale / reference, native && native.maxPixels * reference),
|
|
15394
15463
|
...ox !== 0 || oy !== 0 ? { [ICON_OFFSET_PROPERTY]: [ox, oy] } : {},
|
|
15395
|
-
[ICON_SCREEN_ROTATION_PROPERTY]: 0
|
|
15396
|
-
...native ? groundSizeProperties(native, native.maxPixels * reference) : {}
|
|
15464
|
+
[ICON_SCREEN_ROTATION_PROPERTY]: 0
|
|
15397
15465
|
})
|
|
15398
15466
|
});
|
|
15399
15467
|
}
|
|
@@ -15412,11 +15480,10 @@ function renderCollocationGroup(collocation, capabilities, options) {
|
|
|
15412
15480
|
[COLLOCATION_PART_PROPERTY]: part.part,
|
|
15413
15481
|
[COLLOCATION_MEMBER_PROPERTY]: member.memberId,
|
|
15414
15482
|
iconId: addResource(memberResource(member)),
|
|
15415
|
-
iconScale
|
|
15483
|
+
...iconSize(member.iconScale, member.render.sizeReference),
|
|
15416
15484
|
[ICON_SCREEN_ROTATION_PROPERTY]: 0,
|
|
15417
|
-
[ICON_OFFSET_PROPERTY]:
|
|
15418
|
-
iconOpacity: (style?.opacity ?? 1) * (style?.overallOpacity ?? 1)
|
|
15419
|
-
...native ? groundSizeProperties(native, member.render.sizeReference) : {}
|
|
15485
|
+
[ICON_OFFSET_PROPERTY]: member.iconOffset.map(snap),
|
|
15486
|
+
iconOpacity: (style?.opacity ?? 1) * (style?.overallOpacity ?? 1)
|
|
15420
15487
|
})
|
|
15421
15488
|
});
|
|
15422
15489
|
}
|
|
@@ -16183,6 +16250,7 @@ function runCollocationEdit(opts) {
|
|
|
16183
16250
|
const drawn = renderCollocationGroup(working, capabilities, {
|
|
16184
16251
|
resolution: renderedResolution,
|
|
16185
16252
|
highlight: appearance,
|
|
16253
|
+
nativeGroundScaling: adapter.scalesGroundPointSymbolsNatively === true,
|
|
16186
16254
|
...drag ? { liveLeaders: {
|
|
16187
16255
|
toPixel: driver.toPixel,
|
|
16188
16256
|
fromPixel: driver.fromPixel
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbat-mapper/tactical-draw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
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.47.
|
|
42
|
+
"@orbat-mapper/control-measures": "^0.47.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vitest": ">=4.0.0"
|