@orbat-mapper/tactical-draw 0.2.0-alpha.33 → 0.2.0-alpha.34
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 +21 -2
- package/dist/index.mjs +15 -8
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -233,7 +233,9 @@ interface MapAdapter {
|
|
|
233
233
|
* - features with an `id` that already exists are updated in place;
|
|
234
234
|
* - features with a fresh `id` are added;
|
|
235
235
|
* - features in the layer whose `id` is missing from the incoming set are
|
|
236
|
-
* removed
|
|
236
|
+
* removed;
|
|
237
|
+
* - the incoming array order is authoritative for render order — later
|
|
238
|
+
* features draw on top, so a call that only reorders is a visible change.
|
|
237
239
|
*
|
|
238
240
|
* Features must carry a stable `id`. Use this when you can compute the
|
|
239
241
|
* complete desired state of a layer in one go; for partial removals use
|
|
@@ -375,6 +377,14 @@ interface FeatureOps {
|
|
|
375
377
|
updates: Feature[];
|
|
376
378
|
/** Features whose id was absent from the incoming set. */
|
|
377
379
|
removes?: Feature[];
|
|
380
|
+
/**
|
|
381
|
+
* Complete, ordered snapshot of the layer after this op. The order is
|
|
382
|
+
* authoritative for render order (later features draw on top), so
|
|
383
|
+
* `applyFeatureOps` must leave the layer rendering in `full`'s order — a
|
|
384
|
+
* pure reorder ships identical content in a new order and still counts as a
|
|
385
|
+
* change. Adapters that rebuild the layer from `full` satisfy this for free;
|
|
386
|
+
* incremental adapters must reconcile order against it.
|
|
387
|
+
*/
|
|
378
388
|
full: Feature[];
|
|
379
389
|
replace?: boolean;
|
|
380
390
|
}
|
|
@@ -635,6 +645,15 @@ interface TextSizeProps {
|
|
|
635
645
|
* - no usable size or resolution: `null`.
|
|
636
646
|
*/
|
|
637
647
|
declare function resolveTextSizePixels(props: TextSizeProps, resolution: number): number | null;
|
|
648
|
+
/** Fallback halo color when a `textHalo` feature carries no `textHaloColor`. */
|
|
649
|
+
declare const TEXT_HALO_COLOR = "#ffffff";
|
|
650
|
+
/**
|
|
651
|
+
* Outward depth (px) of a `textHalo` halo from the glyph edge, scaled to font
|
|
652
|
+
* size. This is the halo's *outward* reach, not a stroke width — a canvas
|
|
653
|
+
* stroke straddles the glyph edge (half in, half out), so a caller drawing
|
|
654
|
+
* one must double this value to get the same visible depth.
|
|
655
|
+
*/
|
|
656
|
+
declare function resolveTextHaloWidth(textSizePixels?: number): number;
|
|
638
657
|
//#endregion
|
|
639
658
|
//#region src/gestures/hit-test.d.ts
|
|
640
659
|
type ToPixel = (lonLat: Position) => PixelCoordinate | null;
|
|
@@ -2256,4 +2275,4 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
|
|
|
2256
2275
|
/** `nearestWorldCopyLng` applied to a lon/lat position. */
|
|
2257
2276
|
declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
|
|
2258
2277
|
//#endregion
|
|
2259
|
-
export { BaseMapAdapter, type CombinedAbort, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, type DrawMeasureDraft, type DrawOptions, type DrawPointSymbolDraft, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditOptions, type EditPointerDriver, type EditSession, type FeatureOps, type Graphic, type GraphicEditChangeEvent, type GraphicEditSession, type GraphicGeometrySnappingOptions, type GraphicRender, type GraphicSnapshot, type GuideStyle, HATCH_PATTERNS, type HandleStyle, type HatchPattern, type IconResource, type InteractionHit, type InteractionStyle, type LabelExtent, type LayerId, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type MergedPickFeature, type NativeEventEntry, type PickCandidate, type PickCandidateHit, type PickCandidateHitKind, type PickCandidateInput, type PickEvaluationContext, type PickEvent, type PickHandler, type PickOptions, type PickPointerType, type PixelCoordinate, type PointSymbol, type PointSymbolAnchor, type PointSymbolCapability, PointSymbolCapabilityRequiredError, type PointSymbolColors, type PointSymbolFootprint, type PointSymbolGraphicModifiers, type PointSymbolRender, type PointSymbolSize, type PointSymbolStyle, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type ResolvedPickPresentation, 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, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, type TacticalDrawAbortReason, TacticalDrawDestroyedError, type TacticalDrawLayerOptions, type TacticalDrawOptions, type TextSizeProps, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, type TransientChangeEvent, type TransientPhase, bindAbortable, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, isPointSymbol, isTacticalDrawAbortError, makeFillPatternImage, mergeNativeAndCachedPickFeatures, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, pickPointerType, pointSymbolFootprint, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolvePickPresentation, resolveTextSizePixels, tryControlMeasureIdFromFeature };
|
|
2278
|
+
export { BaseMapAdapter, type CombinedAbort, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, type DrawMeasureDraft, type DrawOptions, type DrawPointSymbolDraft, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditOptions, type EditPointerDriver, type EditSession, type FeatureOps, type Graphic, type GraphicEditChangeEvent, type GraphicEditSession, type GraphicGeometrySnappingOptions, type GraphicRender, type GraphicSnapshot, type GuideStyle, HATCH_PATTERNS, type HandleStyle, type HatchPattern, type IconResource, type InteractionHit, type InteractionStyle, type LabelExtent, type LayerId, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type MergedPickFeature, type NativeEventEntry, type PickCandidate, type PickCandidateHit, type PickCandidateHitKind, type PickCandidateInput, type PickEvaluationContext, type PickEvent, type PickHandler, type PickOptions, type PickPointerType, type PixelCoordinate, type PointSymbol, type PointSymbolAnchor, type PointSymbolCapability, PointSymbolCapabilityRequiredError, type PointSymbolColors, type PointSymbolFootprint, type PointSymbolGraphicModifiers, type PointSymbolRender, type PointSymbolSize, type PointSymbolStyle, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type ResolvedPickPresentation, 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_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, type TacticalDrawAbortReason, TacticalDrawDestroyedError, type TacticalDrawLayerOptions, type TacticalDrawOptions, type TextSizeProps, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, type TransientChangeEvent, type TransientPhase, bindAbortable, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, isPointSymbol, isTacticalDrawAbortError, makeFillPatternImage, mergeNativeAndCachedPickFeatures, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, pickPointerType, pointSymbolFootprint, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolvePickPresentation, resolveTextHaloWidth, resolveTextSizePixels, tryControlMeasureIdFromFeature };
|
package/dist/index.mjs
CHANGED
|
@@ -76,14 +76,10 @@ var BaseMapAdapter = class {
|
|
|
76
76
|
else adds.push(f);
|
|
77
77
|
updateById.set(f.id, f);
|
|
78
78
|
}
|
|
79
|
-
const merged = [];
|
|
79
|
+
const merged = [...updateById.values()];
|
|
80
80
|
const removed = [];
|
|
81
|
-
for (const f of existing) if (f.id
|
|
82
|
-
|
|
83
|
-
updateById.delete(f.id);
|
|
84
|
-
} else if (f.id != null && !updateById.has(f.id)) removed.push(f);
|
|
85
|
-
else merged.push(f);
|
|
86
|
-
for (const f of updateById.values()) merged.push(f);
|
|
81
|
+
for (const f of existing) if (f.id == null) merged.push(f);
|
|
82
|
+
else if (!updateById.has(f.id)) removed.push(f);
|
|
87
83
|
this.featureCache.set(layerId, merged);
|
|
88
84
|
this.applyFeatureOps(layerId, {
|
|
89
85
|
adds,
|
|
@@ -700,6 +696,17 @@ function resolveTextSizePixels(props, resolution) {
|
|
|
700
696
|
}
|
|
701
697
|
return resolveGroundTextSizePixels(meters, resolution, props);
|
|
702
698
|
}
|
|
699
|
+
/** Fallback halo color when a `textHalo` feature carries no `textHaloColor`. */
|
|
700
|
+
const TEXT_HALO_COLOR = "#ffffff";
|
|
701
|
+
/**
|
|
702
|
+
* Outward depth (px) of a `textHalo` halo from the glyph edge, scaled to font
|
|
703
|
+
* size. This is the halo's *outward* reach, not a stroke width — a canvas
|
|
704
|
+
* stroke straddles the glyph edge (half in, half out), so a caller drawing
|
|
705
|
+
* one must double this value to get the same visible depth.
|
|
706
|
+
*/
|
|
707
|
+
function resolveTextHaloWidth(textSizePixels) {
|
|
708
|
+
return Math.max(1.5, (textSizePixels ?? 24) / 8);
|
|
709
|
+
}
|
|
703
710
|
//#endregion
|
|
704
711
|
//#region src/gestures/hit-test.ts
|
|
705
712
|
/** Clamped parameter t ∈ [0, 1] of `pixel` projected onto the segment a→b in pixel space, or null for a zero-length segment. */
|
|
@@ -7091,4 +7098,4 @@ function nearestWorldCopyPosition(position, refLng) {
|
|
|
7091
7098
|
return [nearestWorldCopyLng(position[0], refLng), ...position.slice(1)];
|
|
7092
7099
|
}
|
|
7093
7100
|
//#endregion
|
|
7094
|
-
export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, HATCH_PATTERNS, PointSymbolCapabilityRequiredError, PointerCallbackHub, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, bindAbortable, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, isPointSymbol, isTacticalDrawAbortError, makeFillPatternImage, mergeNativeAndCachedPickFeatures, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, pickPointerType, pointSymbolFootprint, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolvePickPresentation, resolveTextSizePixels, tryControlMeasureIdFromFeature };
|
|
7101
|
+
export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, HATCH_PATTERNS, PointSymbolCapabilityRequiredError, PointerCallbackHub, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, bindAbortable, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, isPointSymbol, isTacticalDrawAbortError, makeFillPatternImage, mergeNativeAndCachedPickFeatures, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, pickPointerType, pointSymbolFootprint, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolvePickPresentation, resolveTextHaloWidth, resolveTextSizePixels, tryControlMeasureIdFromFeature };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbat-mapper/tactical-draw",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.34",
|
|
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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@orbat-mapper/control-measures": "^0.2.0-alpha.
|
|
41
|
+
"@orbat-mapper/control-measures": "^0.2.0-alpha.25"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@arethetypeswrong/core": "^0.18.3",
|