@orbat-mapper/tactical-draw 0.19.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 +30 -137
- package/dist/index.mjs +62 -15
- package/dist/{map-adapter-DFqXaRgp.d.mts → map-adapter-Cq36Qa4q.d.mts} +169 -8
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +94 -47
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
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.
|
|
@@ -357,141 +385,6 @@ declare class PointerCallbackHub {
|
|
|
357
385
|
clear(): void;
|
|
358
386
|
}
|
|
359
387
|
//#endregion
|
|
360
|
-
//#region src/point-symbol.d.ts
|
|
361
|
-
type PointSymbolSize = {
|
|
362
|
-
value: number;
|
|
363
|
-
unit: "pixels";
|
|
364
|
-
} | {
|
|
365
|
-
value: number;
|
|
366
|
-
unit: "meters"; /** Floor for the on-screen projection of the ground-based size; none when omitted. */
|
|
367
|
-
minPixels?: number; /** Cap on the on-screen projection of the ground-based size — typically the pixel size the symbol had when anchored to ground; unclamped when omitted. */
|
|
368
|
-
maxPixels?: number;
|
|
369
|
-
};
|
|
370
|
-
interface PointSymbolGraphicModifiers {
|
|
371
|
-
/** Radians clockwise, relative to the point symbol's own orientation. */
|
|
372
|
-
direction?: number;
|
|
373
|
-
}
|
|
374
|
-
interface PointSymbolColors {
|
|
375
|
-
fill?: string;
|
|
376
|
-
frame?: string;
|
|
377
|
-
icon?: string;
|
|
378
|
-
info?: string;
|
|
379
|
-
outline?: string;
|
|
380
|
-
}
|
|
381
|
-
interface PointSymbolStyle {
|
|
382
|
-
colors?: PointSymbolColors;
|
|
383
|
-
monoColor?: string;
|
|
384
|
-
opacity?: number;
|
|
385
|
-
/** 0–1 multiplier applied to both body and connector opacity; defaults to 1. */
|
|
386
|
-
overallOpacity?: number;
|
|
387
|
-
outlineWidth?: number;
|
|
388
|
-
fill?: boolean;
|
|
389
|
-
frame?: boolean;
|
|
390
|
-
icon?: boolean;
|
|
391
|
-
}
|
|
392
|
-
type PointSymbolPlacement = {
|
|
393
|
-
mode: "screen-relative";
|
|
394
|
-
offset: [number, number];
|
|
395
|
-
} | {
|
|
396
|
-
mode: "ground";
|
|
397
|
-
position: Position;
|
|
398
|
-
};
|
|
399
|
-
/** Modifier that temporarily activates offset placement for a body drag. */
|
|
400
|
-
type OffsetDragModifier = "alt" | "shift" | "ctrl" | "meta";
|
|
401
|
-
type PointSymbolConnector = "auto" | "direct";
|
|
402
|
-
/** Optional connector overrides; omitted properties inherit symbol styling. */
|
|
403
|
-
interface PointSymbolOffsetStyle {
|
|
404
|
-
strokeColor?: string;
|
|
405
|
-
/** 0–1, independent of the body opacity. */
|
|
406
|
-
opacity?: number;
|
|
407
|
-
/** Fixed CSS-pixel width, independent of symbol size. */
|
|
408
|
-
strokeWidth?: number;
|
|
409
|
-
/** Alternating dash/gap lengths in CSS pixels; [] means solid. */
|
|
410
|
-
strokeDash?: number[];
|
|
411
|
-
}
|
|
412
|
-
interface PointSymbolOffset {
|
|
413
|
-
/** Gap at the symbol attachment end, measured along the line in CSS pixels; defaults to 0. */
|
|
414
|
-
anchorPadding?: number;
|
|
415
|
-
style?: PointSymbolOffsetStyle;
|
|
416
|
-
placement: PointSymbolPlacement;
|
|
417
|
-
connector: PointSymbolConnector;
|
|
418
|
-
/** Authored indicator length as a multiple of the displayed octagon size. */
|
|
419
|
-
indicatorLength?: number;
|
|
420
|
-
}
|
|
421
|
-
interface PointSymbol {
|
|
422
|
-
id: string;
|
|
423
|
-
kind: "point-symbol";
|
|
424
|
-
sidc: string;
|
|
425
|
-
position: Position;
|
|
426
|
-
/** Normalized radians clockwise from geographic north. */
|
|
427
|
-
rotation: number;
|
|
428
|
-
/** Milsymbol's octagon-based L dimension. */
|
|
429
|
-
size: PointSymbolSize;
|
|
430
|
-
offset?: PointSymbolOffset;
|
|
431
|
-
textAmplifiers?: TextAmplifiers;
|
|
432
|
-
graphicModifiers?: PointSymbolGraphicModifiers;
|
|
433
|
-
style?: PointSymbolStyle;
|
|
434
|
-
rendererOptions?: {
|
|
435
|
-
milsymbol?: Record<string, unknown>;
|
|
436
|
-
};
|
|
437
|
-
properties?: Record<string, unknown>;
|
|
438
|
-
schemaVersion?: 1;
|
|
439
|
-
}
|
|
440
|
-
interface PointSymbolAnchor {
|
|
441
|
-
x: number;
|
|
442
|
-
y: number;
|
|
443
|
-
}
|
|
444
|
-
/** Canonical-size, renderer-neutral point-symbol output. */
|
|
445
|
-
interface PointSymbolRender {
|
|
446
|
-
/** Content-derived identity for adapter-wide native-resource reuse. */
|
|
447
|
-
resourceId: string;
|
|
448
|
-
svg: string;
|
|
449
|
-
/** Renderer-space octagon size used to interpret persisted symbol size. */
|
|
450
|
-
octagonSize: number;
|
|
451
|
-
width: number;
|
|
452
|
-
height: number;
|
|
453
|
-
anchor: PointSymbolAnchor;
|
|
454
|
-
octagonAnchor: PointSymbolAnchor;
|
|
455
|
-
valid: boolean;
|
|
456
|
-
validation?: unknown;
|
|
457
|
-
/** Optional body/attachment capability. All coordinates are canonical SVG units. */
|
|
458
|
-
offset?: {
|
|
459
|
-
body: PointSymbolRender; /** Body registration in the ordinary image, preserving natural HQ placement. */
|
|
460
|
-
ordinaryRegistration: PointSymbolAnchor;
|
|
461
|
-
attachment: PointSymbolAnchor;
|
|
462
|
-
indicator?: {
|
|
463
|
-
direction: PointSymbolAnchor;
|
|
464
|
-
length: number;
|
|
465
|
-
minLength?: number;
|
|
466
|
-
};
|
|
467
|
-
strokeColor: string;
|
|
468
|
-
strokeWidth: number;
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
interface PointSymbolCapability {
|
|
472
|
-
readonly defaultSize: PointSymbolSize;
|
|
473
|
-
readonly defaultRotation: number;
|
|
474
|
-
render(symbol: PointSymbol): PointSymbolRender;
|
|
475
|
-
invalidate(): void;
|
|
476
|
-
/**
|
|
477
|
-
* Monotonic counter that increments on each `invalidate()` call. Consumers
|
|
478
|
-
* (e.g. a render cache keyed on graphic snapshot identity) may read this to
|
|
479
|
-
* detect that previously rendered point-symbol output is stale even though
|
|
480
|
-
* the graphic snapshot itself is unchanged. Optional — when absent,
|
|
481
|
-
* invalidation cannot be detected by cache layers, so they must not attempt
|
|
482
|
-
* to key on it.
|
|
483
|
-
*/
|
|
484
|
-
readonly generation?: number;
|
|
485
|
-
}
|
|
486
|
-
declare function isPointSymbol(graphic: unknown): graphic is PointSymbol;
|
|
487
|
-
declare function clonePointSymbol(symbol: PointSymbol): PointSymbol;
|
|
488
|
-
/**
|
|
489
|
-
* Replace a point-symbol size value as a user-driven resize. Ground-size display
|
|
490
|
-
* bounds scale with the value so they continue to constrain zoom changes rather
|
|
491
|
-
* than preventing the resize itself.
|
|
492
|
-
*/
|
|
493
|
-
declare function resizePointSymbolSize(size: PointSymbolSize, value: number): PointSymbolSize;
|
|
494
|
-
//#endregion
|
|
495
388
|
//#region src/image-graphic.d.ts
|
|
496
389
|
type ImageSize = {
|
|
497
390
|
value: number;
|
|
@@ -2433,4 +2326,4 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
|
|
|
2433
2326
|
/** `nearestWorldCopyLng` applied to a lon/lat position. */
|
|
2434
2327
|
declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
|
|
2435
2328
|
//#endregion
|
|
2436
|
-
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 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
|
@@ -258,10 +258,16 @@ function evaluateIcon(feature, resource, context) {
|
|
|
258
258
|
const angle = (typeof rawRotation === "number" && Number.isFinite(rawRotation) ? rawRotation : 0) - (context.bearing ?? 0);
|
|
259
259
|
const cos = Math.cos(angle);
|
|
260
260
|
const sin = Math.sin(angle);
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
const contentRect = resource.contentRect ?? {
|
|
262
|
+
x: 0,
|
|
263
|
+
y: 0,
|
|
264
|
+
width: resource.width,
|
|
265
|
+
height: resource.height
|
|
266
|
+
};
|
|
267
|
+
const minX = (contentRect.x - resource.anchor[0]) * scale;
|
|
268
|
+
const maxX = (contentRect.x + contentRect.width - resource.anchor[0]) * scale;
|
|
269
|
+
const minY = (contentRect.y - resource.anchor[1]) * scale;
|
|
270
|
+
const maxY = (contentRect.y + contentRect.height - resource.anchor[1]) * scale;
|
|
265
271
|
const dx = context.pixel[0] - anchor[0];
|
|
266
272
|
const dy = context.pixel[1] - anchor[1];
|
|
267
273
|
const localX = dx * cos + dy * sin;
|
|
@@ -269,12 +275,7 @@ function evaluateIcon(feature, resource, context) {
|
|
|
269
275
|
const outsideX = Math.max(minX - localX, 0, localX - maxX);
|
|
270
276
|
const outsideY = Math.max(minY - localY, 0, localY - maxY);
|
|
271
277
|
if (outsideX > context.tolerance || outsideY > context.tolerance) return null;
|
|
272
|
-
const coreRect = resource.coreRect ??
|
|
273
|
-
x: 0,
|
|
274
|
-
y: 0,
|
|
275
|
-
width: resource.width,
|
|
276
|
-
height: resource.height
|
|
277
|
-
};
|
|
278
|
+
const coreRect = resource.coreRect ?? contentRect;
|
|
278
279
|
const coreMinX = (coreRect.x - resource.anchor[0]) * scale;
|
|
279
280
|
const coreMaxX = (coreRect.x + coreRect.width - resource.anchor[0]) * scale;
|
|
280
281
|
const coreMinY = (coreRect.y - resource.anchor[1]) * scale;
|
|
@@ -647,6 +648,45 @@ function coerceHandleStyle(raw) {
|
|
|
647
648
|
return raw;
|
|
648
649
|
}
|
|
649
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
|
+
/**
|
|
650
690
|
* Default lower edge of the ground-anchored label band (ADR-0060): below it a
|
|
651
691
|
* label fades out and hides on the map, rather than pinning.
|
|
652
692
|
*/
|
|
@@ -1750,6 +1790,7 @@ function pointSymbolResource(render) {
|
|
|
1750
1790
|
width: render.width,
|
|
1751
1791
|
height: render.height,
|
|
1752
1792
|
anchor: [render.anchor.x, render.anchor.y],
|
|
1793
|
+
...render.contentBounds ? { contentRect: render.contentBounds } : {},
|
|
1753
1794
|
coreRect: {
|
|
1754
1795
|
x: render.octagonAnchor.x - render.octagonSize / 2,
|
|
1755
1796
|
y: render.octagonAnchor.y - render.octagonSize / 2,
|
|
@@ -5998,14 +6039,20 @@ function pointSymbolFootprint(symbol, render, adapter) {
|
|
|
5998
6039
|
render = layout.render;
|
|
5999
6040
|
const scale = pointSymbolPixelScale(symbol, render, adapter.getResolution());
|
|
6000
6041
|
const angle = symbol.rotation - adapter.getBearing();
|
|
6001
|
-
const
|
|
6002
|
-
|
|
6042
|
+
const content = render.contentBounds ?? {
|
|
6043
|
+
x: 0,
|
|
6044
|
+
y: 0,
|
|
6045
|
+
width: render.width,
|
|
6046
|
+
height: render.height
|
|
6047
|
+
};
|
|
6048
|
+
const centerOffsetX = (content.x + content.width / 2 - render.anchor.x) * scale;
|
|
6049
|
+
const centerOffsetY = (content.y + content.height / 2 - render.anchor.y) * scale;
|
|
6003
6050
|
const cos = Math.cos(angle);
|
|
6004
6051
|
const sin = Math.sin(angle);
|
|
6005
6052
|
const box = {
|
|
6006
6053
|
center: [anchor[0] + centerOffsetX * cos - centerOffsetY * sin, anchor[1] + centerOffsetX * sin + centerOffsetY * cos],
|
|
6007
|
-
halfWidth:
|
|
6008
|
-
halfHeight:
|
|
6054
|
+
halfWidth: content.width * scale / 2,
|
|
6055
|
+
halfHeight: content.height * scale / 2,
|
|
6009
6056
|
angle
|
|
6010
6057
|
};
|
|
6011
6058
|
return {
|
|
@@ -10485,4 +10532,4 @@ function nearestWorldCopyPosition(position, refLng) {
|
|
|
10485
10532
|
return [nearestWorldCopyLng(position[0], refLng), ...position.slice(1)];
|
|
10486
10533
|
}
|
|
10487
10534
|
//#endregion
|
|
10488
|
-
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PatternId } from "@orbat-mapper/control-measures";
|
|
1
|
+
import { PatternId, TextAmplifiers } from "@orbat-mapper/control-measures";
|
|
2
2
|
import { Feature, Position } from "geojson";
|
|
3
3
|
|
|
4
4
|
//#region src/pin-presentation.d.ts
|
|
@@ -166,6 +166,154 @@ declare class PinPresentationStore {
|
|
|
166
166
|
onChange(listener: (state: PinPresentationState) => void): () => void;
|
|
167
167
|
}
|
|
168
168
|
//#endregion
|
|
169
|
+
//#region src/point-symbol.d.ts
|
|
170
|
+
type PointSymbolSize = {
|
|
171
|
+
value: number;
|
|
172
|
+
unit: "pixels";
|
|
173
|
+
} | {
|
|
174
|
+
value: number;
|
|
175
|
+
unit: "meters"; /** Floor for the on-screen projection of the ground-based size; none when omitted. */
|
|
176
|
+
minPixels?: number; /** Cap on the on-screen projection of the ground-based size — typically the pixel size the symbol had when anchored to ground; unclamped when omitted. */
|
|
177
|
+
maxPixels?: number;
|
|
178
|
+
};
|
|
179
|
+
interface PointSymbolGraphicModifiers {
|
|
180
|
+
/** Radians clockwise, relative to the point symbol's own orientation. */
|
|
181
|
+
direction?: number;
|
|
182
|
+
}
|
|
183
|
+
interface PointSymbolColors {
|
|
184
|
+
fill?: string;
|
|
185
|
+
frame?: string;
|
|
186
|
+
icon?: string;
|
|
187
|
+
info?: string;
|
|
188
|
+
outline?: string;
|
|
189
|
+
}
|
|
190
|
+
interface PointSymbolStyle {
|
|
191
|
+
colors?: PointSymbolColors;
|
|
192
|
+
monoColor?: string;
|
|
193
|
+
opacity?: number;
|
|
194
|
+
/** 0–1 multiplier applied to both body and connector opacity; defaults to 1. */
|
|
195
|
+
overallOpacity?: number;
|
|
196
|
+
outlineWidth?: number;
|
|
197
|
+
fill?: boolean;
|
|
198
|
+
frame?: boolean;
|
|
199
|
+
icon?: boolean;
|
|
200
|
+
}
|
|
201
|
+
type PointSymbolPlacement = {
|
|
202
|
+
mode: "screen-relative";
|
|
203
|
+
offset: [number, number];
|
|
204
|
+
} | {
|
|
205
|
+
mode: "ground";
|
|
206
|
+
position: Position;
|
|
207
|
+
};
|
|
208
|
+
/** Modifier that temporarily activates offset placement for a body drag. */
|
|
209
|
+
type OffsetDragModifier = "alt" | "shift" | "ctrl" | "meta";
|
|
210
|
+
type PointSymbolConnector = "auto" | "direct";
|
|
211
|
+
/** Optional connector overrides; omitted properties inherit symbol styling. */
|
|
212
|
+
interface PointSymbolOffsetStyle {
|
|
213
|
+
strokeColor?: string;
|
|
214
|
+
/** 0–1, independent of the body opacity. */
|
|
215
|
+
opacity?: number;
|
|
216
|
+
/** Fixed CSS-pixel width, independent of symbol size. */
|
|
217
|
+
strokeWidth?: number;
|
|
218
|
+
/** Alternating dash/gap lengths in CSS pixels; [] means solid. */
|
|
219
|
+
strokeDash?: number[];
|
|
220
|
+
}
|
|
221
|
+
interface PointSymbolOffset {
|
|
222
|
+
/** Gap at the symbol attachment end, measured along the line in CSS pixels; defaults to 0. */
|
|
223
|
+
anchorPadding?: number;
|
|
224
|
+
style?: PointSymbolOffsetStyle;
|
|
225
|
+
placement: PointSymbolPlacement;
|
|
226
|
+
connector: PointSymbolConnector;
|
|
227
|
+
/** Authored indicator length as a multiple of the displayed octagon size. */
|
|
228
|
+
indicatorLength?: number;
|
|
229
|
+
}
|
|
230
|
+
interface PointSymbol {
|
|
231
|
+
id: string;
|
|
232
|
+
kind: "point-symbol";
|
|
233
|
+
sidc: string;
|
|
234
|
+
position: Position;
|
|
235
|
+
/** Normalized radians clockwise from geographic north. */
|
|
236
|
+
rotation: number;
|
|
237
|
+
/** Milsymbol's octagon-based L dimension. */
|
|
238
|
+
size: PointSymbolSize;
|
|
239
|
+
offset?: PointSymbolOffset;
|
|
240
|
+
textAmplifiers?: TextAmplifiers;
|
|
241
|
+
graphicModifiers?: PointSymbolGraphicModifiers;
|
|
242
|
+
style?: PointSymbolStyle;
|
|
243
|
+
rendererOptions?: {
|
|
244
|
+
milsymbol?: Record<string, unknown>;
|
|
245
|
+
};
|
|
246
|
+
properties?: Record<string, unknown>;
|
|
247
|
+
schemaVersion?: 1;
|
|
248
|
+
}
|
|
249
|
+
interface PointSymbolAnchor {
|
|
250
|
+
x: number;
|
|
251
|
+
y: number;
|
|
252
|
+
}
|
|
253
|
+
interface PointSymbolRect {
|
|
254
|
+
x: number;
|
|
255
|
+
y: number;
|
|
256
|
+
width: number;
|
|
257
|
+
height: number;
|
|
258
|
+
}
|
|
259
|
+
/** Canonical-size, renderer-neutral point-symbol output. */
|
|
260
|
+
interface PointSymbolRender {
|
|
261
|
+
/** Content-derived identity for adapter-wide native-resource reuse. */
|
|
262
|
+
resourceId: string;
|
|
263
|
+
svg: string;
|
|
264
|
+
/** Renderer-space octagon size used to interpret persisted symbol size. */
|
|
265
|
+
octagonSize: number;
|
|
266
|
+
width: number;
|
|
267
|
+
height: number;
|
|
268
|
+
/**
|
|
269
|
+
* Visible content box in canonical SVG units, relative to the image's
|
|
270
|
+
* top-left. Footprints, hit tests and edit boxes use it, so transparent
|
|
271
|
+
* padding (e.g. room for a soft halo) is not clickable; the image itself is
|
|
272
|
+
* still drawn at `width × height`. Defaults to the full image.
|
|
273
|
+
*/
|
|
274
|
+
contentBounds?: PointSymbolRect;
|
|
275
|
+
anchor: PointSymbolAnchor;
|
|
276
|
+
octagonAnchor: PointSymbolAnchor;
|
|
277
|
+
valid: boolean;
|
|
278
|
+
validation?: unknown;
|
|
279
|
+
/** Optional body/attachment capability. All coordinates are canonical SVG units. */
|
|
280
|
+
offset?: {
|
|
281
|
+
body: PointSymbolRender; /** Body registration in the ordinary image, preserving natural HQ placement. */
|
|
282
|
+
ordinaryRegistration: PointSymbolAnchor;
|
|
283
|
+
attachment: PointSymbolAnchor;
|
|
284
|
+
indicator?: {
|
|
285
|
+
direction: PointSymbolAnchor;
|
|
286
|
+
length: number;
|
|
287
|
+
minLength?: number;
|
|
288
|
+
};
|
|
289
|
+
strokeColor: string;
|
|
290
|
+
strokeWidth: number;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
interface PointSymbolCapability {
|
|
294
|
+
readonly defaultSize: PointSymbolSize;
|
|
295
|
+
readonly defaultRotation: number;
|
|
296
|
+
render(symbol: PointSymbol): PointSymbolRender;
|
|
297
|
+
invalidate(): void;
|
|
298
|
+
/**
|
|
299
|
+
* Monotonic counter that increments on each `invalidate()` call. Consumers
|
|
300
|
+
* (e.g. a render cache keyed on graphic snapshot identity) may read this to
|
|
301
|
+
* detect that previously rendered point-symbol output is stale even though
|
|
302
|
+
* the graphic snapshot itself is unchanged. Optional — when absent,
|
|
303
|
+
* invalidation cannot be detected by cache layers, so they must not attempt
|
|
304
|
+
* to key on it.
|
|
305
|
+
*/
|
|
306
|
+
readonly generation?: number;
|
|
307
|
+
}
|
|
308
|
+
declare function isPointSymbol(graphic: unknown): graphic is PointSymbol;
|
|
309
|
+
declare function clonePointSymbol(symbol: PointSymbol): PointSymbol;
|
|
310
|
+
/**
|
|
311
|
+
* Replace a point-symbol size value as a user-driven resize. Ground-size display
|
|
312
|
+
* bounds scale with the value so they continue to constrain zoom changes rather
|
|
313
|
+
* than preventing the resize itself.
|
|
314
|
+
*/
|
|
315
|
+
declare function resizePointSymbolSize(size: PointSymbolSize, value: number): PointSymbolSize;
|
|
316
|
+
//#endregion
|
|
169
317
|
//#region src/gestures/types.d.ts
|
|
170
318
|
interface PointerEventInfo {
|
|
171
319
|
/** Per-event hit-tolerance override (e.g. larger for touch). */
|
|
@@ -348,6 +496,17 @@ interface HandleStyle {
|
|
|
348
496
|
*/
|
|
349
497
|
fillPattern?: "solid" | HatchPattern;
|
|
350
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;
|
|
351
510
|
}
|
|
352
511
|
type LayerId = string;
|
|
353
512
|
/** Canonical SVG resource shared by point features through `iconId`. */
|
|
@@ -357,17 +516,19 @@ interface IconResource {
|
|
|
357
516
|
width: number;
|
|
358
517
|
height: number;
|
|
359
518
|
anchor: [number, number];
|
|
519
|
+
/**
|
|
520
|
+
* Visible content box in unscaled canvas coordinates. Icon picks and their
|
|
521
|
+
* footprints use it instead of the full canvas, so transparent padding is not
|
|
522
|
+
* hit area; the icon is still drawn at `width × height`. Defaults to the full
|
|
523
|
+
* canvas.
|
|
524
|
+
*/
|
|
525
|
+
contentRect?: PointSymbolRect;
|
|
360
526
|
/**
|
|
361
527
|
* Direct visible mark used to rank icon picks, in unscaled canvas coordinates.
|
|
362
528
|
* Hits elsewhere in the full canvas measure their distance from this rectangle;
|
|
363
529
|
* omit it to preserve whole-canvas distance-zero behavior.
|
|
364
530
|
*/
|
|
365
|
-
coreRect?:
|
|
366
|
-
x: number;
|
|
367
|
-
y: number;
|
|
368
|
-
width: number;
|
|
369
|
-
height: number;
|
|
370
|
-
};
|
|
531
|
+
coreRect?: PointSymbolRect;
|
|
371
532
|
}
|
|
372
533
|
/** A self-contained image fixed to four geographic corners, ordered TL/TR/BR/BL. */
|
|
373
534
|
interface ImageOverlayResource {
|
|
@@ -579,4 +740,4 @@ interface MapAdapter {
|
|
|
579
740
|
getLayerFeatures(layerId: LayerId): readonly Feature[];
|
|
580
741
|
}
|
|
581
742
|
//#endregion
|
|
582
|
-
export {
|
|
743
|
+
export { PinPresentationStatusEvent as $, PointSymbolAnchor as A, PointSymbolSize as B, makeFillPatternImage as C, PointerEventInfo as D, PointerCallback as E, PointSymbolOffset as F, DEFAULT_PIN_PRESENTATION as G, clonePointSymbol as H, PointSymbolOffsetStyle as I, PinPresentation as J, PinFootprint as K, PointSymbolPlacement as L, PointSymbolColors as M, PointSymbolConnector as N, OffsetDragModifier as O, PointSymbolGraphicModifiers as P, PinPresentationStatus as Q, PointSymbolRect as R, isMinePattern as S, EditPointerDriver as T, isPointSymbol as U, PointSymbolStyle as V, resizePointSymbolSize as W, PinPresentationPatch as X, PinPresentationCapability as Y, PinPresentationState as Z, HatchPattern as _, LayerId as a, pinZoomScale as at, fillPatternImageDimension as b, MapEvent as c, PickHandler as d, PinPresentationStore as et, PickOptions as f, HATCH_PATTERNS as g, TextStyleOptions as h, ImageOverlayResource as i, pinDistanceScale as it, PointSymbolCapability as j, PointSymbol as k, MapEventHandler as l, StyleOptions as m, HandleStyle as n, combinePinScale as nt, MapAdapter as o, resolvePinPresentation as ot, PixelCoordinate as p, PinOverridePatch as q, IconResource as r, isValidPinNumber as rt, MapCursor as s, FeatureGroup as t, PinRender as tt, PickEvent as u, MINE_PATTERN_TILE_SIZE as v, parseColor as w, fillPatternImageId as x, Rgba as y, PointSymbolRender as z };
|
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"
|