@orbat-mapper/tactical-draw 0.28.1 → 0.30.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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as PinPresentationCapability, A as PointSymbolConnector, B as isPointSymbol, C as makeFillPatternImage, D as PointSymbolAnchor, E as PointSymbol, F as PointSymbolRect, G as ResolvedEditModifiers, H as DEFAULT_EDIT_MODIFIERS, I as PointSymbolRender, J as PointerEventInfo, K as EditPointerDriver, L as PointSymbolSize, M as PointSymbolOffset, N as PointSymbolOffsetStyle, O as PointSymbolCapability, P as PointSymbolPlacement, Q as PinPresentation, R as PointSymbolStyle, S as isMinePattern, T as OffsetDragModifier, U as EditModifiers, V as resizePointSymbolSize, W as ModifierKey, X as PinFootprint, Y as DEFAULT_PIN_PRESENTATION, Z as PinOverridePatch, _ as HatchPattern, a as LayerId, at as PinRender, b as fillPatternImageDimension, c as MapEvent, ct as pinDistanceScale, d as PickHandler, et as PinPresentationPatch, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, it as PinPresentationStore, j as PointSymbolGraphicModifiers, k as PointSymbolColors, l as MapEventHandler, lt as pinZoomScale, m as StyleOptions, n as HandleStyle, nt as PinPresentationStatus, o as MapAdapter, ot as combinePinScale, p as PixelCoordinate, q as PointerCallback, r as IconResource, rt as PinPresentationStatusEvent, s as MapCursor, st as isValidPinNumber, t as FeatureGroup, tt as PinPresentationState, u as PickEvent, ut as resolvePinPresentation, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as clonePointSymbol } from "./map-adapter-
|
|
1
|
+
import { $ as PinPresentationCapability, A as PointSymbolConnector, B as isPointSymbol, C as makeFillPatternImage, D as PointSymbolAnchor, E as PointSymbol, F as PointSymbolRect, G as ResolvedEditModifiers, H as DEFAULT_EDIT_MODIFIERS, I as PointSymbolRender, J as PointerEventInfo, K as EditPointerDriver, L as PointSymbolSize, M as PointSymbolOffset, N as PointSymbolOffsetStyle, O as PointSymbolCapability, P as PointSymbolPlacement, Q as PinPresentation, R as PointSymbolStyle, S as isMinePattern, T as OffsetDragModifier, U as EditModifiers, V as resizePointSymbolSize, W as ModifierKey, X as PinFootprint, Y as DEFAULT_PIN_PRESENTATION, Z as PinOverridePatch, _ as HatchPattern, a as LayerId, at as PinRender, b as fillPatternImageDimension, c as MapEvent, ct as pinDistanceScale, d as PickHandler, et as PinPresentationPatch, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, it as PinPresentationStore, j as PointSymbolGraphicModifiers, k as PointSymbolColors, l as MapEventHandler, lt as pinZoomScale, m as StyleOptions, n as HandleStyle, nt as PinPresentationStatus, o as MapAdapter, ot as combinePinScale, p as PixelCoordinate, q as PointerCallback, r as IconResource, rt as PinPresentationStatusEvent, s as MapCursor, st as isValidPinNumber, t as FeatureGroup, tt as PinPresentationState, u as PickEvent, ut as resolvePinPresentation, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as clonePointSymbol } from "./map-adapter-BBbauQ5S.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
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_HIGHLIGHT_WIDTH, DEFAULT_LABEL_HEIGHT_CSS_PIXELS, DEFAULT_SYMBOL_COLOR, FILL_PATTERN_DEFINITIONS, LABEL_FADE_END_RATIO, NON_SOLID_FILL_PATTERNS, applyBoxTransformOptions, canDeleteControlMeasureVertex, canonicalTextAmplifierKey, cloneControlMeasure, controlMeasureIdFromFeature, dragControlMeasureOptionHandle, foldsBoxTransformOptions, freezeOrientationOptions, getControlMeasureMetadata, getControlMeasureModifierDrag, getControlMeasureOptionHandles, getControlMeasurePartOf, getControlMeasureSegments, getDefaultOptions, keepControlMeasureDrawnSize, labelSizeBandHideThreshold, normalizeTextAmplifiers, remapVertexAlignedOptions, renderControlMeasure, resetControlMeasureOptionHandle, resolveAmplifierPlacement, resolveSizePair, resolveStyleHints, resolveSymbolColor, roundToFixed, switchSizePairUnit } from "@orbat-mapper/control-measures";
|
|
1
|
+
import { DEFAULT_HIGHLIGHT_WIDTH, DEFAULT_LABEL_HEIGHT_CSS_PIXELS, DEFAULT_SYMBOL_COLOR, FILL_PATTERN_DEFINITIONS, LABEL_FADE_END_RATIO, NON_SOLID_FILL_PATTERNS, applyBoxTransformOptions, canDeleteControlMeasureVertex, canonicalTextAmplifierKey, cloneControlMeasure, controlMeasureIdFromFeature, dragControlMeasureOptionHandle, foldsBoxTransformOptions, freezeOrientationOptions, getControlMeasureMetadata, getControlMeasureModifierDrag, getControlMeasureOptionHandles, getControlMeasurePartOf, getControlMeasureSegments, getDefaultOptions, keepControlMeasureDrawnSize, labelSizeBandHideThreshold, labelTextOffsetEms, normalizeTextAmplifiers, remapVertexAlignedOptions, renderControlMeasure, resetControlMeasureOptionHandle, resolveAmplifierPlacement, resolveSizePair, resolveStyleHints, resolveSymbolColor, roundToFixed, switchSizePairUnit } from "@orbat-mapper/control-measures";
|
|
2
2
|
function pickPointerType(originalEvent) {
|
|
3
3
|
if (typeof PointerEvent !== "undefined" && originalEvent instanceof PointerEvent) {
|
|
4
4
|
if (originalEvent.pointerType === "touch") return "touch";
|
|
@@ -4677,14 +4677,15 @@ function normalizeAngle(angle) {
|
|
|
4677
4677
|
* half the fitted width along the label's local +x for `"start"` (text
|
|
4678
4678
|
* grows away from the anchor) or local −x for `"end"` (text grows back
|
|
4679
4679
|
* toward the anchor) — `rotate()` (`transform-box.ts`) already uses the
|
|
4680
|
-
* screen (y-down) convention this offset needs.
|
|
4680
|
+
* screen (y-down) convention this offset needs. The label's screen-space
|
|
4681
|
+
* `textOffsetEms` further moves it by that many `h` in the same local frame.
|
|
4681
4682
|
* - **Hidden**: a ground-anchored size past `textMaxSizePixels` (ADR-0037),
|
|
4682
4683
|
* or faded out below the band minimum (ADR-0060), returns `null` — the box
|
|
4683
4684
|
* tracks `resolveTextAppearance`'s hide rule rather than keep boxing text
|
|
4684
4685
|
* that no adapter is drawing.
|
|
4685
4686
|
*/
|
|
4686
4687
|
function fitLabelTransformBox(input) {
|
|
4687
|
-
const { text, rotation, textAnchor, textSizePixels, textSizeMeters, anchor, resolution, bearing, unclamped, textMaxSizePixels, labelSizeBand } = input;
|
|
4688
|
+
const { text, rotation, textAnchor, textOffsetEms, textSizePixels, textSizeMeters, anchor, resolution, bearing, unclamped, textMaxSizePixels, labelSizeBand } = input;
|
|
4688
4689
|
if (!text) return null;
|
|
4689
4690
|
const angle = normalizeAngle(Math.PI - (rotation ?? 0) - (bearing ?? 0));
|
|
4690
4691
|
let h = 16;
|
|
@@ -4703,9 +4704,12 @@ function fitLabelTransformBox(input) {
|
|
|
4703
4704
|
const height = lines.length * LINE_HEIGHT_FACTOR * h;
|
|
4704
4705
|
const halfWidth = width / 2 + 4;
|
|
4705
4706
|
const halfHeight = height / 2 + 4;
|
|
4707
|
+
const [offsetRight, offsetDown] = textOffsetEms ?? [0, 0];
|
|
4708
|
+
const localX = (textAnchor === "start" ? width / 2 : textAnchor === "end" ? -width / 2 : 0) + offsetRight * h;
|
|
4709
|
+
const localY = offsetDown * h;
|
|
4706
4710
|
let center = anchor;
|
|
4707
|
-
if (
|
|
4708
|
-
const [ox, oy] = rotate(
|
|
4711
|
+
if (localX !== 0 || localY !== 0) {
|
|
4712
|
+
const [ox, oy] = rotate(localX, localY, angle);
|
|
4709
4713
|
center = [anchor[0] + ox, anchor[1] + oy];
|
|
4710
4714
|
}
|
|
4711
4715
|
return {
|
|
@@ -4730,6 +4734,7 @@ function fitLabelBoxFromFeature(feature, anchorPixel, view) {
|
|
|
4730
4734
|
text: typeof props.text === "string" ? props.text : void 0,
|
|
4731
4735
|
rotation: typeof props.rotation === "number" ? props.rotation : void 0,
|
|
4732
4736
|
textAnchor: props.textAnchor === "start" || props.textAnchor === "end" ? props.textAnchor : void 0,
|
|
4737
|
+
textOffsetEms: labelTextOffsetEms(props),
|
|
4733
4738
|
textSizePixels: typeof props.textSizePixels === "number" ? props.textSizePixels : void 0,
|
|
4734
4739
|
textSizeMeters: typeof props.textSizeMeters === "number" ? props.textSizeMeters : void 0,
|
|
4735
4740
|
textMaxSizePixels: typeof props.textMaxSizePixels === "number" ? props.textMaxSizePixels : void 0,
|
|
@@ -5014,6 +5019,7 @@ function createLabelPlacement(deps) {
|
|
|
5014
5019
|
downPixel: pixel,
|
|
5015
5020
|
text: typeof props.text === "string" ? props.text : void 0,
|
|
5016
5021
|
textAnchor: props.textAnchor === "start" || props.textAnchor === "end" ? props.textAnchor : void 0,
|
|
5022
|
+
textOffsetEms: labelTextOffsetEms(props),
|
|
5017
5023
|
textSizePixels: typeof props.textSizePixels === "number" ? props.textSizePixels : void 0,
|
|
5018
5024
|
textSizeMeters: typeof props.textSizeMeters === "number" ? props.textSizeMeters : void 0,
|
|
5019
5025
|
lastBox: labelBox
|
|
@@ -5053,6 +5059,7 @@ function createLabelPlacement(deps) {
|
|
|
5053
5059
|
text: drag.text,
|
|
5054
5060
|
rotation,
|
|
5055
5061
|
textAnchor: drag.textAnchor,
|
|
5062
|
+
textOffsetEms: drag.textOffsetEms,
|
|
5056
5063
|
textSizePixels: drag.textSizePixels,
|
|
5057
5064
|
textSizeMeters: drag.textSizeMeters,
|
|
5058
5065
|
anchor: drag.anchorPixel,
|
|
@@ -5399,12 +5406,16 @@ function runEdit(opts) {
|
|
|
5399
5406
|
}]);
|
|
5400
5407
|
}
|
|
5401
5408
|
/** Live view scale for option handles behind pixel-authored sizes. */
|
|
5402
|
-
|
|
5403
|
-
function optionHandleContext(modifier = false) {
|
|
5409
|
+
function optionHandleContext() {
|
|
5404
5410
|
const resolution = adapter.getResolution();
|
|
5411
|
+
return hasUsableResolution(resolution) ? { constructionMetersPerCssPixel: resolution } : {};
|
|
5412
|
+
}
|
|
5413
|
+
/** A drag or reset's context: the view scale, the press's modifier-drag key, the selected parts. */
|
|
5414
|
+
function optionHandleGesture(modifier) {
|
|
5405
5415
|
return {
|
|
5406
|
-
...
|
|
5407
|
-
...modifier ? { modifier: true } : {}
|
|
5416
|
+
...optionHandleContext(),
|
|
5417
|
+
...modifier ? { modifier: true } : {},
|
|
5418
|
+
...parts.selected !== void 0 ? { parts: parts.parts } : {}
|
|
5408
5419
|
};
|
|
5409
5420
|
}
|
|
5410
5421
|
function buildCurrentHandleSet() {
|
|
@@ -6006,7 +6017,7 @@ function runEdit(opts) {
|
|
|
6006
6017
|
if (frame.part !== void 0) parts.select(frame.part);
|
|
6007
6018
|
}
|
|
6008
6019
|
function optionsForOptionHandle(position, drag) {
|
|
6009
|
-
const patch = dragControlMeasureOptionHandle(measure.kind, workingPoints, drag.preDragOptions, drag.handleId, position,
|
|
6020
|
+
const patch = dragControlMeasureOptionHandle(measure.kind, workingPoints, drag.preDragOptions, drag.handleId, position, optionHandleGesture(drag.modifier));
|
|
6010
6021
|
return patch ? {
|
|
6011
6022
|
...drag.preDragOptions ?? {},
|
|
6012
6023
|
...patch
|
|
@@ -6196,7 +6207,7 @@ function runEdit(opts) {
|
|
|
6196
6207
|
}
|
|
6197
6208
|
const optionModifier = hit.kind === "option" && modifierHeld(info, keys().modifierDrag);
|
|
6198
6209
|
if (hit.kind === "option" && hit.optionId && deleteOrReset) {
|
|
6199
|
-
const patch = resetControlMeasureOptionHandle(measure.kind, workingPoints, workingOptions, hit.optionId,
|
|
6210
|
+
const patch = resetControlMeasureOptionHandle(measure.kind, workingPoints, workingOptions, hit.optionId, optionHandleGesture(optionModifier));
|
|
6200
6211
|
if (patch) {
|
|
6201
6212
|
setOptions(patch, "gesture", "Reset option handle");
|
|
6202
6213
|
shell.suppressNextClickAway();
|
|
@@ -510,8 +510,11 @@ interface StyleOptions {
|
|
|
510
510
|
* Text (label) style for a layer. When `labelProperty` is set, adapters also
|
|
511
511
|
* read per-feature label properties: `rotation` (radians, rendered as
|
|
512
512
|
* `π − rotation`), the size anchor's `textSizeMeters` (ground) or
|
|
513
|
-
* `textSizePixels` (screen) (ADR-0028),
|
|
514
|
-
* begins at the label point, `"end"` = text ends there; absent = centered)
|
|
513
|
+
* `textSizePixels` (screen) (ADR-0028), `textAnchor` (`"start"` = text
|
|
514
|
+
* begins at the label point, `"end"` = text ends there; absent = centered),
|
|
515
|
+
* and the screen-space offset `textAnchorGap`/`textBaselineShift` (ems of the
|
|
516
|
+
* rendered size, applied after rotation in the text's own frame; read it as
|
|
517
|
+
* `[right, down]` with `labelTextOffsetEms`, ADR-0068).
|
|
515
518
|
* A ground-anchored label renders at `textSizeMeters / resolution`, pinned at
|
|
516
519
|
* `textSizeMaxPixels` and faded out then hidden below `textSizeMinPixels`
|
|
517
520
|
* (`resolveTextAppearance`, ADR-0060); a screen-anchored one at a constant
|
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-BBbauQ5S.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.
|
|
3
|
+
"version": "0.30.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.
|
|
42
|
+
"@orbat-mapper/control-measures": "^0.45.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vitest": ">=4.0.0"
|