@orbat-mapper/tactical-draw 0.20.0 → 0.21.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 PinPresentationStatusEvent, A as PointSymbolAnchor, B as PointSymbolSize, C as makeFillPatternImage, D as PointerEventInfo, E as PointerCallback, F as PointSymbolOffset, G as DEFAULT_PIN_PRESENTATION, H as clonePointSymbol, I as PointSymbolOffsetStyle, J as PinPresentation, K as PinFootprint, L as PointSymbolPlacement, M as PointSymbolColors, N as PointSymbolConnector, O as OffsetDragModifier, P as PointSymbolGraphicModifiers, Q as PinPresentationStatus, R as PointSymbolRect, S as isMinePattern, T as EditPointerDriver, U as isPointSymbol, V as PointSymbolStyle, W as resizePointSymbolSize, X as PinPresentationPatch, Y as PinPresentationCapability, Z as PinPresentationState, _ as HatchPattern, a as LayerId, at as pinZoomScale, b as fillPatternImageDimension, c as MapEvent, d as PickHandler, et as PinPresentationStore, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, it as pinDistanceScale, j as PointSymbolCapability, k as PointSymbol, l as MapEventHandler, m as StyleOptions, n as HandleStyle, nt as combinePinScale, o as MapAdapter, ot as resolvePinPresentation, p as PixelCoordinate, q as PinOverridePatch, r as IconResource, rt as isValidPinNumber, s as MapCursor, t as FeatureGroup, tt as PinRender, u as PickEvent, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as PointSymbolRender } from "./map-adapter-
|
|
1
|
+
import { $ as PinPresentationStatusEvent, A as PointSymbolAnchor, B as PointSymbolSize, C as makeFillPatternImage, D as PointerEventInfo, E as PointerCallback, F as PointSymbolOffset, G as DEFAULT_PIN_PRESENTATION, H as clonePointSymbol, I as PointSymbolOffsetStyle, J as PinPresentation, K as PinFootprint, L as PointSymbolPlacement, M as PointSymbolColors, N as PointSymbolConnector, O as OffsetDragModifier, P as PointSymbolGraphicModifiers, Q as PinPresentationStatus, R as PointSymbolRect, S as isMinePattern, T as EditPointerDriver, U as isPointSymbol, V as PointSymbolStyle, W as resizePointSymbolSize, X as PinPresentationPatch, Y as PinPresentationCapability, Z as PinPresentationState, _ as HatchPattern, a as LayerId, at as pinZoomScale, b as fillPatternImageDimension, c as MapEvent, d as PickHandler, et as PinPresentationStore, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, it as pinDistanceScale, j as PointSymbolCapability, k as PointSymbol, l as MapEventHandler, m as StyleOptions, n as HandleStyle, nt as combinePinScale, o as MapAdapter, ot as resolvePinPresentation, p as PixelCoordinate, q as PinOverridePatch, r as IconResource, rt as isValidPinNumber, s as MapCursor, t as FeatureGroup, tt as PinRender, u as PickEvent, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as PointSymbolRender } from "./map-adapter-Cq36Qa4q.mjs";
|
|
2
2
|
import { AmplifierPlacement, AmplifierPlacements, ControlMeasure, ControlMeasureKind, ControlMeasureRender, ControlMeasureStyle, LabelFit, SymbolColors, TextAmplifiers } from "@orbat-mapper/control-measures";
|
|
3
3
|
import { Feature, Position } from "geojson";
|
|
4
4
|
|
|
@@ -218,6 +218,34 @@ declare function resolvePickPresentation(feature: Feature, layerStyle?: StyleOpt
|
|
|
218
218
|
* when missing or shaped wrong so callers fall through to the layer style.
|
|
219
219
|
*/
|
|
220
220
|
declare function coerceHandleStyle(raw: unknown): HandleStyle | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* How far a Highlight casing reaches past each side of the stroke, in CSS
|
|
223
|
+
* pixels. The casing is a solid line `strokeWidth + 2 × outset` wide, so the
|
|
224
|
+
* default 2 px stroke gets an 8 px orange band: wide enough to read as a
|
|
225
|
+
* highlighter mark, narrow enough not to swallow neighbouring graphics.
|
|
226
|
+
*/
|
|
227
|
+
declare const HIGHLIGHT_CASING_OUTSET_CSS_PIXELS = 3;
|
|
228
|
+
/** Width of the Highlight casing beneath a stroke `strokeWidth` px wide. */
|
|
229
|
+
declare function highlightCasingWidth(strokeWidth: number): number;
|
|
230
|
+
/** The solid casing an adapter paints beneath a highlighted part. */
|
|
231
|
+
interface HighlightCasing {
|
|
232
|
+
color: string;
|
|
233
|
+
/** Full casing width in CSS pixels: the stroke width plus the outset on each side. */
|
|
234
|
+
width: number;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Whether a rendered feature gets a Highlight casing: only a line or area part
|
|
238
|
+
* whose `properties.style` carries the renderer's resolved `highlightColor`.
|
|
239
|
+
*/
|
|
240
|
+
declare function hasHighlightCasing(feature: Feature): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* The Highlight casing for a rendered feature, or `null` when it has none
|
|
243
|
+
* (see {@link hasHighlightCasing}); an area is cased along its outline. The width
|
|
244
|
+
* follows the part's own `strokeWidth`, else `fallbackStrokeWidth` — the
|
|
245
|
+
* stroke width the adapter would draw it at — whatever the stroke color, so
|
|
246
|
+
* a fully transparent stroke is cased too.
|
|
247
|
+
*/
|
|
248
|
+
declare function resolveHighlightCasing(feature: Feature, fallbackStrokeWidth: number): HighlightCasing | null;
|
|
221
249
|
/**
|
|
222
250
|
* Default lower edge of the ground-anchored label band (ADR-0060): below it a
|
|
223
251
|
* label fades out and hides on the map, rather than pinning.
|
|
@@ -2298,4 +2326,4 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
|
|
|
2298
2326
|
/** `nearestWorldCopyLng` applied to a lon/lat position. */
|
|
2299
2327
|
declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
|
|
2300
2328
|
//#endregion
|
|
2301
|
-
export { type AnchoredGraphic, BaseMapAdapter, type CombinedAbort, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_MARKER_SIZE, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, type DeferredSnapProvider, type DrawImageDraft, type DrawMarkerDraft, type DrawMeasureDraft, type DrawOptions, type DrawPointSymbolDraft, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditOptions, type EditPointerDriver, type EditSession, type FeatureGroup, type Graphic, type GraphicEditChangeEvent, type GraphicEditSession, type GraphicGeometrySnappingOptions, type GraphicRender, type GraphicSnapshot, type GuideStyle, HATCH_PATTERNS, type HandleStyle, type HatchPattern, type IconResource, type ImageCapability, ImageCapabilityRequiredError, type ImageFootprint, type ImageGraphic, type ImageGraphicStyle, type ImageIntrinsicSize, type ImageOverlayResource, type ImageRender, type ImageResource, type ImageSize, type InteractionHit, type InteractionStyle, type LabelExtent, type LabelSizeBand, type LayerId, MINE_PATTERN_TILE_SIZE, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type Marker, type MarkerAnchor, type MarkerCapability, MarkerCapabilityRequiredError, type MarkerFootprint, type MarkerIcon, type MarkerRender, type MarkerSize, type MarkerStyle, type MergedPickFeature, type NativeEventEntry, type OffsetDragModifier, type PickCandidate, type PickCandidateHit, type PickCandidateHitKind, type PickCandidateInput, type PickEvaluationContext, type PickEvent, type PickHandler, type PickOptions, type PickPointerType, PinFootprint, PinOverridePatch, PinPresentation, PinPresentationCapability, PinPresentationPatch, PinPresentationState, PinPresentationStatus, PinPresentationStatusEvent, PinPresentationStore, PinRender, type PinnableGraphic, type PixelCoordinate, type PointSymbol, type PointSymbolAnchor, type PointSymbolCapability, PointSymbolCapabilityRequiredError, type PointSymbolColors, type PointSymbolConnector, type PointSymbolFootprint, type PointSymbolGraphicModifiers, type PointSymbolOffset, type PointSymbolOffsetControls, type PointSymbolOffsetLayout, type PointSymbolOffsetStyle, type PointSymbolPlacement, type PointSymbolProjection, type PointSymbolRect, type PointSymbolRender, type PointSymbolSize, type PointSymbolStyle, type PointSymbolView, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type ResolvedPickPresentation, type Rgba, type RotatedScreenBounds, type ScreenBounds, type SessionChangeSource, type SessionHistory, type SessionHistoryState, type SettleReason, type SizeAnchor, type SnapCandidate, type SnapCandidateProvider, type SnapCandidateRequest, type SnapInteraction, type SnapResult, type SnappingOptions, type StyleOptions, TEXT_FADE_END_RATIO, TEXT_HALO_BREAKPOINT_PIXELS, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, type TacticalDrawAbortReason, TacticalDrawDestroyedError, type TacticalDrawLayerOptions, type TacticalDrawOptions, type TextAppearance, type TextSizeProps, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, type TransientChangeEvent, type TransientPhase, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
|
|
2329
|
+
export { type AnchoredGraphic, BaseMapAdapter, type CombinedAbort, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_MARKER_SIZE, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, type DeferredSnapProvider, type DrawImageDraft, type DrawMarkerDraft, type DrawMeasureDraft, type DrawOptions, type DrawPointSymbolDraft, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditOptions, type EditPointerDriver, type EditSession, type FeatureGroup, type Graphic, type GraphicEditChangeEvent, type GraphicEditSession, type GraphicGeometrySnappingOptions, type GraphicRender, type GraphicSnapshot, type GuideStyle, HATCH_PATTERNS, HIGHLIGHT_CASING_OUTSET_CSS_PIXELS, type HandleStyle, type HatchPattern, type HighlightCasing, type IconResource, type ImageCapability, ImageCapabilityRequiredError, type ImageFootprint, type ImageGraphic, type ImageGraphicStyle, type ImageIntrinsicSize, type ImageOverlayResource, type ImageRender, type ImageResource, type ImageSize, type InteractionHit, type InteractionStyle, type LabelExtent, type LabelSizeBand, type LayerId, MINE_PATTERN_TILE_SIZE, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type Marker, type MarkerAnchor, type MarkerCapability, MarkerCapabilityRequiredError, type MarkerFootprint, type MarkerIcon, type MarkerRender, type MarkerSize, type MarkerStyle, type MergedPickFeature, type NativeEventEntry, type OffsetDragModifier, type PickCandidate, type PickCandidateHit, type PickCandidateHitKind, type PickCandidateInput, type PickEvaluationContext, type PickEvent, type PickHandler, type PickOptions, type PickPointerType, PinFootprint, PinOverridePatch, PinPresentation, PinPresentationCapability, PinPresentationPatch, PinPresentationState, PinPresentationStatus, PinPresentationStatusEvent, PinPresentationStore, PinRender, type PinnableGraphic, type PixelCoordinate, type PointSymbol, type PointSymbolAnchor, type PointSymbolCapability, PointSymbolCapabilityRequiredError, type PointSymbolColors, type PointSymbolConnector, type PointSymbolFootprint, type PointSymbolGraphicModifiers, type PointSymbolOffset, type PointSymbolOffsetControls, type PointSymbolOffsetLayout, type PointSymbolOffsetStyle, type PointSymbolPlacement, type PointSymbolProjection, type PointSymbolRect, type PointSymbolRender, type PointSymbolSize, type PointSymbolStyle, type PointSymbolView, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type ResolvedPickPresentation, type Rgba, type RotatedScreenBounds, type ScreenBounds, type SessionChangeSource, type SessionHistory, type SessionHistoryState, type SettleReason, type SizeAnchor, type SnapCandidate, type SnapCandidateProvider, type SnapCandidateRequest, type SnapInteraction, type SnapResult, type SnappingOptions, type StyleOptions, TEXT_FADE_END_RATIO, TEXT_HALO_BREAKPOINT_PIXELS, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, type TacticalDrawAbortReason, TacticalDrawDestroyedError, type TacticalDrawLayerOptions, type TacticalDrawOptions, type TextAppearance, type TextSizeProps, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, type TransientChangeEvent, type TransientPhase, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hasHighlightCasing, highlightCasingWidth, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolveHighlightCasing, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
|
package/dist/index.mjs
CHANGED
|
@@ -648,6 +648,45 @@ function coerceHandleStyle(raw) {
|
|
|
648
648
|
return raw;
|
|
649
649
|
}
|
|
650
650
|
/**
|
|
651
|
+
* How far a Highlight casing reaches past each side of the stroke, in CSS
|
|
652
|
+
* pixels. The casing is a solid line `strokeWidth + 2 × outset` wide, so the
|
|
653
|
+
* default 2 px stroke gets an 8 px orange band: wide enough to read as a
|
|
654
|
+
* highlighter mark, narrow enough not to swallow neighbouring graphics.
|
|
655
|
+
*/
|
|
656
|
+
const HIGHLIGHT_CASING_OUTSET_CSS_PIXELS = 3;
|
|
657
|
+
/** Width of the Highlight casing beneath a stroke `strokeWidth` px wide. */
|
|
658
|
+
function highlightCasingWidth(strokeWidth) {
|
|
659
|
+
return strokeWidth + 6;
|
|
660
|
+
}
|
|
661
|
+
const CASED_GEOMETRIES = new Set([
|
|
662
|
+
"LineString",
|
|
663
|
+
"MultiLineString",
|
|
664
|
+
"Polygon",
|
|
665
|
+
"MultiPolygon"
|
|
666
|
+
]);
|
|
667
|
+
/**
|
|
668
|
+
* Whether a rendered feature gets a Highlight casing: only a line or area part
|
|
669
|
+
* whose `properties.style` carries the renderer's resolved `highlightColor`.
|
|
670
|
+
*/
|
|
671
|
+
function hasHighlightCasing(feature) {
|
|
672
|
+
return typeof coerceHandleStyle(feature.properties?.style)?.highlightColor === "string" && CASED_GEOMETRIES.has(feature.geometry?.type ?? "");
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* The Highlight casing for a rendered feature, or `null` when it has none
|
|
676
|
+
* (see {@link hasHighlightCasing}); an area is cased along its outline. The width
|
|
677
|
+
* follows the part's own `strokeWidth`, else `fallbackStrokeWidth` — the
|
|
678
|
+
* stroke width the adapter would draw it at — whatever the stroke color, so
|
|
679
|
+
* a fully transparent stroke is cased too.
|
|
680
|
+
*/
|
|
681
|
+
function resolveHighlightCasing(feature, fallbackStrokeWidth) {
|
|
682
|
+
if (!hasHighlightCasing(feature)) return null;
|
|
683
|
+
const style = coerceHandleStyle(feature.properties?.style);
|
|
684
|
+
return {
|
|
685
|
+
color: style.highlightColor,
|
|
686
|
+
width: highlightCasingWidth(typeof style.strokeWidth === "number" ? style.strokeWidth : fallbackStrokeWidth)
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
651
690
|
* Default lower edge of the ground-anchored label band (ADR-0060): below it a
|
|
652
691
|
* label fades out and hides on the map, rather than pinning.
|
|
653
692
|
*/
|
|
@@ -10493,4 +10532,4 @@ function nearestWorldCopyPosition(position, refLng) {
|
|
|
10493
10532
|
return [nearestWorldCopyLng(position[0], refLng), ...position.slice(1)];
|
|
10494
10533
|
}
|
|
10495
10534
|
//#endregion
|
|
10496
|
-
export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_MARKER_SIZE, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, HATCH_PATTERNS, ImageCapabilityRequiredError, MINE_PATTERN_TILE_SIZE, MarkerCapabilityRequiredError, PinPresentationStore, PointSymbolCapabilityRequiredError, PointerCallbackHub, TEXT_FADE_END_RATIO, TEXT_HALO_BREAKPOINT_PIXELS, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
|
|
10535
|
+
export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_MARKER_SIZE, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, HATCH_PATTERNS, HIGHLIGHT_CASING_OUTSET_CSS_PIXELS, ImageCapabilityRequiredError, MINE_PATTERN_TILE_SIZE, MarkerCapabilityRequiredError, PinPresentationStore, PointSymbolCapabilityRequiredError, PointerCallbackHub, TEXT_FADE_END_RATIO, TEXT_HALO_BREAKPOINT_PIXELS, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hasHighlightCasing, highlightCasingWidth, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolveHighlightCasing, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
|
|
@@ -496,6 +496,17 @@ interface HandleStyle {
|
|
|
496
496
|
*/
|
|
497
497
|
fillPattern?: "solid" | HatchPattern;
|
|
498
498
|
pointRadius?: number;
|
|
499
|
+
/**
|
|
500
|
+
* Highlight casing color for a line or area part (the renderer's resolved
|
|
501
|
+
* `style.highlight`, opacity already folded in). Adapters paint a solid
|
|
502
|
+
* casing `highlightCasingWidth(strokeWidth)` wide along the geometry —
|
|
503
|
+
* outline only for an area — beneath every fill and stroke of the
|
|
504
|
+
* feature's group, even when the stroke itself is transparent. The casing
|
|
505
|
+
* is display-only: it never widens the feature's hit area. Per-feature
|
|
506
|
+
* only: layer-level `StyleOptions` has no equivalent. Not to be confused
|
|
507
|
+
* with the transient selection highlight of `setHighlightedGraphics`.
|
|
508
|
+
*/
|
|
509
|
+
highlightColor?: string;
|
|
499
510
|
}
|
|
500
511
|
type LayerId = string;
|
|
501
512
|
/** Canonical SVG resource shared by point features through `iconId`. */
|
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-Cq36Qa4q.mjs";
|
|
2
2
|
import { Feature } from "geojson";
|
|
3
3
|
|
|
4
4
|
//#region src/testing/feature-group-conformance.d.ts
|
package/dist/testing.mjs
CHANGED
|
@@ -2,53 +2,86 @@ import { describe, expect, it } from "vitest";
|
|
|
2
2
|
//#region src/testing/feature-group-conformance.ts
|
|
3
3
|
function runFeatureGroupConformance(name, createSubject, options = {}) {
|
|
4
4
|
describe(`${name} feature-group conformance`, () => {
|
|
5
|
-
if (options.canonicalFeatureOrder)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
5
|
+
if (options.canonicalFeatureOrder) {
|
|
6
|
+
it("paints interleaved feature content in canonical array order", () => {
|
|
7
|
+
const subject = createSubject();
|
|
8
|
+
const { adapter, layerId } = subject;
|
|
9
|
+
const icon = iconResource("order-icon");
|
|
10
|
+
const mixed = canonicalOrderFeatures(icon.id);
|
|
11
|
+
adapter.setLayerStyle(layerId, { text: { labelProperty: "label" } });
|
|
12
|
+
adapter.setLayerFeatureGroups(layerId, [group$1("mixed", mixed, [icon]), group$1("upper", [line$1("upper-stroke")])]);
|
|
13
|
+
expect(subject.paintSequence?.()).toEqual([
|
|
14
|
+
"solid:fill",
|
|
15
|
+
"solid:stroke",
|
|
16
|
+
"label:text",
|
|
17
|
+
"pattern:pattern",
|
|
18
|
+
"pattern:stroke",
|
|
19
|
+
"icon:icon",
|
|
20
|
+
"last-stroke:stroke",
|
|
21
|
+
"upper-stroke:stroke"
|
|
22
|
+
]);
|
|
23
|
+
const updated = [
|
|
24
|
+
mixed[3],
|
|
25
|
+
mixed[0],
|
|
26
|
+
mixed[1],
|
|
27
|
+
mixed[2],
|
|
28
|
+
mixed[4]
|
|
29
|
+
];
|
|
30
|
+
adapter.setLayerFeatureGroups(layerId, [group$1("mixed", updated, [icon]), group$1("upper", [line$1("upper-stroke")])]);
|
|
31
|
+
expect(subject.paintSequence?.()).toEqual([
|
|
32
|
+
"icon:icon",
|
|
33
|
+
"solid:fill",
|
|
34
|
+
"solid:stroke",
|
|
35
|
+
"label:text",
|
|
36
|
+
"pattern:pattern",
|
|
37
|
+
"pattern:stroke",
|
|
38
|
+
"last-stroke:stroke",
|
|
39
|
+
"upper-stroke:stroke"
|
|
40
|
+
]);
|
|
41
|
+
adapter.setLayerFeatureGroups(layerId, [group$1("upper", [line$1("upper-stroke")]), group$1("mixed", updated, [icon])]);
|
|
42
|
+
expect(subject.paintSequence?.()).toEqual([
|
|
43
|
+
"upper-stroke:stroke",
|
|
44
|
+
"icon:icon",
|
|
45
|
+
"solid:fill",
|
|
46
|
+
"solid:stroke",
|
|
47
|
+
"label:text",
|
|
48
|
+
"pattern:pattern",
|
|
49
|
+
"pattern:stroke",
|
|
50
|
+
"last-stroke:stroke"
|
|
51
|
+
]);
|
|
52
|
+
});
|
|
53
|
+
it("paints a highlighted graphic's casings beneath all of its own paint", () => {
|
|
54
|
+
const subject = createSubject();
|
|
55
|
+
const { adapter, layerId } = subject;
|
|
56
|
+
const highlighted = [highlight(polygon$1("area")), highlight(line$1("shaft"))];
|
|
57
|
+
adapter.setLayerFeatureGroups(layerId, [
|
|
58
|
+
group$1("lower", [line$1("lower-stroke")]),
|
|
59
|
+
group$1("highlighted", highlighted),
|
|
60
|
+
group$1("upper", [line$1("upper-stroke")])
|
|
61
|
+
]);
|
|
62
|
+
expect(subject.paintSequence?.()).toEqual([
|
|
63
|
+
"lower-stroke:stroke",
|
|
64
|
+
"area:casing",
|
|
65
|
+
"shaft:casing",
|
|
66
|
+
"area:fill",
|
|
67
|
+
"area:stroke",
|
|
68
|
+
"shaft:stroke",
|
|
69
|
+
"upper-stroke:stroke"
|
|
70
|
+
]);
|
|
71
|
+
adapter.setLayerFeatureGroups(layerId, [
|
|
72
|
+
group$1("lower", [line$1("lower-stroke")]),
|
|
73
|
+
group$1("highlighted", [polygon$1("area"), line$1("shaft")]),
|
|
74
|
+
group$1("upper", [line$1("upper-stroke")])
|
|
75
|
+
]);
|
|
76
|
+
expect(subject.paintSequence?.()).toEqual([
|
|
77
|
+
"lower-stroke:stroke",
|
|
78
|
+
"area:fill",
|
|
79
|
+
"area:stroke",
|
|
80
|
+
"shaft:stroke",
|
|
81
|
+
"upper-stroke:stroke"
|
|
82
|
+
]);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
52
85
|
it("reconciles complete ordered group state, including pure reorders", () => {
|
|
53
86
|
const subject = createSubject();
|
|
54
87
|
const { adapter, layerId } = subject;
|
|
@@ -170,6 +203,20 @@ function iconPoint(id, iconId) {
|
|
|
170
203
|
properties: { iconId }
|
|
171
204
|
};
|
|
172
205
|
}
|
|
206
|
+
/** The same feature as a highlighted graphic's part: the renderer's resolved casing color. */
|
|
207
|
+
function highlight(feature) {
|
|
208
|
+
const style = feature.properties?.style ?? {};
|
|
209
|
+
return {
|
|
210
|
+
...feature,
|
|
211
|
+
properties: {
|
|
212
|
+
...feature.properties,
|
|
213
|
+
style: {
|
|
214
|
+
...style,
|
|
215
|
+
highlightColor: "#ff6a00"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
173
220
|
function line$1(id) {
|
|
174
221
|
return {
|
|
175
222
|
type: "Feature",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbat-mapper/tactical-draw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.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.37.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vitest": ">=4.0.0"
|