@orbat-mapper/tactical-draw 0.19.0 → 0.20.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 { 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-D6pkU0iz.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
|
|
|
@@ -357,141 +357,6 @@ declare class PointerCallbackHub {
|
|
|
357
357
|
clear(): void;
|
|
358
358
|
}
|
|
359
359
|
//#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
360
|
//#region src/image-graphic.d.ts
|
|
496
361
|
type ImageSize = {
|
|
497
362
|
value: number;
|
|
@@ -2433,4 +2298,4 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
|
|
|
2433
2298
|
/** `nearestWorldCopyLng` applied to a lon/lat position. */
|
|
2434
2299
|
declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
|
|
2435
2300
|
//#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 };
|
|
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 };
|
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;
|
|
@@ -1750,6 +1751,7 @@ function pointSymbolResource(render) {
|
|
|
1750
1751
|
width: render.width,
|
|
1751
1752
|
height: render.height,
|
|
1752
1753
|
anchor: [render.anchor.x, render.anchor.y],
|
|
1754
|
+
...render.contentBounds ? { contentRect: render.contentBounds } : {},
|
|
1753
1755
|
coreRect: {
|
|
1754
1756
|
x: render.octagonAnchor.x - render.octagonSize / 2,
|
|
1755
1757
|
y: render.octagonAnchor.y - render.octagonSize / 2,
|
|
@@ -5998,14 +6000,20 @@ function pointSymbolFootprint(symbol, render, adapter) {
|
|
|
5998
6000
|
render = layout.render;
|
|
5999
6001
|
const scale = pointSymbolPixelScale(symbol, render, adapter.getResolution());
|
|
6000
6002
|
const angle = symbol.rotation - adapter.getBearing();
|
|
6001
|
-
const
|
|
6002
|
-
|
|
6003
|
+
const content = render.contentBounds ?? {
|
|
6004
|
+
x: 0,
|
|
6005
|
+
y: 0,
|
|
6006
|
+
width: render.width,
|
|
6007
|
+
height: render.height
|
|
6008
|
+
};
|
|
6009
|
+
const centerOffsetX = (content.x + content.width / 2 - render.anchor.x) * scale;
|
|
6010
|
+
const centerOffsetY = (content.y + content.height / 2 - render.anchor.y) * scale;
|
|
6003
6011
|
const cos = Math.cos(angle);
|
|
6004
6012
|
const sin = Math.sin(angle);
|
|
6005
6013
|
const box = {
|
|
6006
6014
|
center: [anchor[0] + centerOffsetX * cos - centerOffsetY * sin, anchor[1] + centerOffsetX * sin + centerOffsetY * cos],
|
|
6007
|
-
halfWidth:
|
|
6008
|
-
halfHeight:
|
|
6015
|
+
halfWidth: content.width * scale / 2,
|
|
6016
|
+
halfHeight: content.height * scale / 2,
|
|
6009
6017
|
angle
|
|
6010
6018
|
};
|
|
6011
6019
|
return {
|
|
@@ -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). */
|
|
@@ -357,17 +505,19 @@ interface IconResource {
|
|
|
357
505
|
width: number;
|
|
358
506
|
height: number;
|
|
359
507
|
anchor: [number, number];
|
|
508
|
+
/**
|
|
509
|
+
* Visible content box in unscaled canvas coordinates. Icon picks and their
|
|
510
|
+
* footprints use it instead of the full canvas, so transparent padding is not
|
|
511
|
+
* hit area; the icon is still drawn at `width × height`. Defaults to the full
|
|
512
|
+
* canvas.
|
|
513
|
+
*/
|
|
514
|
+
contentRect?: PointSymbolRect;
|
|
360
515
|
/**
|
|
361
516
|
* Direct visible mark used to rank icon picks, in unscaled canvas coordinates.
|
|
362
517
|
* Hits elsewhere in the full canvas measure their distance from this rectangle;
|
|
363
518
|
* omit it to preserve whole-canvas distance-zero behavior.
|
|
364
519
|
*/
|
|
365
|
-
coreRect?:
|
|
366
|
-
x: number;
|
|
367
|
-
y: number;
|
|
368
|
-
width: number;
|
|
369
|
-
height: number;
|
|
370
|
-
};
|
|
520
|
+
coreRect?: PointSymbolRect;
|
|
371
521
|
}
|
|
372
522
|
/** A self-contained image fixed to four geographic corners, ordered TL/TR/BR/BL. */
|
|
373
523
|
interface ImageOverlayResource {
|
|
@@ -579,4 +729,4 @@ interface MapAdapter {
|
|
|
579
729
|
getLayerFeatures(layerId: LayerId): readonly Feature[];
|
|
580
730
|
}
|
|
581
731
|
//#endregion
|
|
582
|
-
export {
|
|
732
|
+
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-D6pkU0iz.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.20.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",
|