@orbat-mapper/tactical-draw 0.11.1 → 0.13.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 PinOverridePatch, B as
|
|
1
|
+
import { A as PinOverridePatch, B as isValidPinNumber, C as makeFillPatternImage, D as PointerEventInfo, E as PointerCallback, F as PinPresentationStatus, H as pinZoomScale, I as PinPresentationStatusEvent, L as PinPresentationStore, M as PinPresentationCapability, N as PinPresentationPatch, O as DEFAULT_PIN_PRESENTATION, P as PinPresentationState, R as PinRender, S as isMinePattern, T as EditPointerDriver, U as resolvePinPresentation, V as pinDistanceScale, _ as HatchPattern, a as LayerId, b as fillPatternImageDimension, c as MapEvent, d as PickHandler, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, j as PinPresentation, k as PinFootprint, l as MapEventHandler, m as StyleOptions, n as HandleStyle, o as MapAdapter, p as PixelCoordinate, r as IconResource, s as MapCursor, t as FeatureGroup, u as PickEvent, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as combinePinScale } from "./map-adapter-B8zVKzWH.mjs";
|
|
2
2
|
import { AmplifierPlacement, AmplifierPlacements, ControlMeasure, ControlMeasureKind, ControlMeasureRender, ControlMeasureStyle, SymbolColors, TextAmplifiers } from "@orbat-mapper/control-measures";
|
|
3
3
|
import { Feature, Position } from "geojson";
|
|
4
4
|
|
|
@@ -2252,4 +2252,4 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
|
|
|
2252
2252
|
/** `nearestWorldCopyLng` applied to a lon/lat position. */
|
|
2253
2253
|
declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
|
|
2254
2254
|
//#endregion
|
|
2255
|
-
export { type AnchoredGraphic, BaseMapAdapter, type CombinedAbort, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, type DrawImageDraft, 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 LayerId, MINE_PATTERN_TILE_SIZE, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, 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 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_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, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMinePattern, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, parseColor, pickHitTolerance, pickPointerType, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic };
|
|
2255
|
+
export { type AnchoredGraphic, BaseMapAdapter, type CombinedAbort, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, type DrawImageDraft, 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 LayerId, MINE_PATTERN_TILE_SIZE, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, 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 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_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, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMinePattern, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic };
|
package/dist/index.mjs
CHANGED
|
@@ -1087,13 +1087,28 @@ function createCommitEmitter(listenerErrorsMessage) {
|
|
|
1087
1087
|
}
|
|
1088
1088
|
//#endregion
|
|
1089
1089
|
//#region src/pin-presentation.ts
|
|
1090
|
+
/** Nested settings, merged key by key rather than replaced by a patch. */
|
|
1091
|
+
const sections = [
|
|
1092
|
+
"stem",
|
|
1093
|
+
"dot",
|
|
1094
|
+
"halo",
|
|
1095
|
+
"symbolHalo",
|
|
1096
|
+
"plate",
|
|
1097
|
+
"zoomScale",
|
|
1098
|
+
"distanceScale",
|
|
1099
|
+
"sizeLimits"
|
|
1100
|
+
];
|
|
1101
|
+
const viewWideKeys = [
|
|
1102
|
+
"mode",
|
|
1103
|
+
"occlusion",
|
|
1104
|
+
"prioritizePins",
|
|
1105
|
+
"depthSort",
|
|
1106
|
+
"zoomScale",
|
|
1107
|
+
"distanceScale",
|
|
1108
|
+
"sizeLimits"
|
|
1109
|
+
];
|
|
1090
1110
|
function validateOverride(patch) {
|
|
1091
|
-
for (const key of
|
|
1092
|
-
"mode",
|
|
1093
|
-
"occlusion",
|
|
1094
|
-
"prioritizePins",
|
|
1095
|
-
"depthSort"
|
|
1096
|
-
]) if (Object.hasOwn(patch, key)) throw new TypeError(`Pin setting ${key} is view-wide only`);
|
|
1111
|
+
for (const key of viewWideKeys) if (Object.hasOwn(patch, key)) throw new TypeError(`Pin setting ${key} is view-wide only`);
|
|
1097
1112
|
}
|
|
1098
1113
|
const DEFAULT_PIN_PRESENTATION = Object.freeze({
|
|
1099
1114
|
enabled: false,
|
|
@@ -1132,15 +1147,53 @@ const DEFAULT_PIN_PRESENTATION = Object.freeze({
|
|
|
1132
1147
|
padding: 4,
|
|
1133
1148
|
radius: 4,
|
|
1134
1149
|
opacity: .95
|
|
1150
|
+
}),
|
|
1151
|
+
zoomScale: Object.freeze({
|
|
1152
|
+
enabled: false,
|
|
1153
|
+
fullSizeZoom: 12,
|
|
1154
|
+
falloff: .85
|
|
1155
|
+
}),
|
|
1156
|
+
distanceScale: Object.freeze({
|
|
1157
|
+
enabled: false,
|
|
1158
|
+
strength: .5
|
|
1159
|
+
}),
|
|
1160
|
+
sizeLimits: Object.freeze({
|
|
1161
|
+
minScale: .45,
|
|
1162
|
+
maxScale: 1.4
|
|
1135
1163
|
})
|
|
1136
1164
|
});
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1165
|
+
/**
|
|
1166
|
+
* Multiplier for screen-space pin dimensions at `zoom`, never above 1; 1 when zoom
|
|
1167
|
+
* scaling is off. Unbounded below: combinePinScale applies `sizeLimits`.
|
|
1168
|
+
*/
|
|
1169
|
+
function pinZoomScale(presentation, zoom) {
|
|
1170
|
+
const { enabled, fullSizeZoom, falloff } = presentation.zoomScale;
|
|
1171
|
+
if (!enabled || zoom >= fullSizeZoom) return 1;
|
|
1172
|
+
return Math.min(1, falloff ** (fullSizeZoom - zoom));
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Perspective multiplier for a pin at camera depth `depth` (clip-space w), relative
|
|
1176
|
+
* to the view center at `referenceDepth`; 1 when distance scaling is off. Unbounded:
|
|
1177
|
+
* combinePinScale applies `sizeLimits`. Engines that scale on the GPU must mirror
|
|
1178
|
+
* this formula in their shader.
|
|
1179
|
+
*/
|
|
1180
|
+
function pinDistanceScale(presentation, depth, referenceDepth) {
|
|
1181
|
+
const { enabled, strength } = presentation.distanceScale;
|
|
1182
|
+
if (!enabled || !(depth > 0) || !(referenceDepth > 0)) return 1;
|
|
1183
|
+
return (referenceDepth / depth) ** strength;
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Combined screen-space pin scale from the two mode factors (as returned by
|
|
1187
|
+
* pinZoomScale and pinDistanceScale), bounded by `sizeLimits` while either mode is
|
|
1188
|
+
* enabled; if its `minScale` exceeds `maxScale`, `maxScale` wins. Engines that
|
|
1189
|
+
* scale on the GPU must mirror this in their shader.
|
|
1190
|
+
*/
|
|
1191
|
+
function combinePinScale(presentation, zoomScale, distanceScale) {
|
|
1192
|
+
const scale = zoomScale * distanceScale;
|
|
1193
|
+
if (!presentation.zoomScale.enabled && !presentation.distanceScale.enabled) return scale;
|
|
1194
|
+
const { minScale, maxScale } = presentation.sizeLimits;
|
|
1195
|
+
return Math.min(maxScale, Math.max(minScale, scale));
|
|
1196
|
+
}
|
|
1144
1197
|
/**
|
|
1145
1198
|
* Whether `value` is an acceptable number for the pin setting named `key`.
|
|
1146
1199
|
* Exported so a host's input handling can reject a value with the same rules
|
|
@@ -3111,6 +3164,17 @@ function runEditInteraction(spec) {
|
|
|
3111
3164
|
}
|
|
3112
3165
|
//#endregion
|
|
3113
3166
|
//#region src/tactical-draw/handles.ts
|
|
3167
|
+
/** Size of a `compact` option handle relative to its slot's style. */
|
|
3168
|
+
const COMPACT_HANDLE_SCALE = 2 / 3;
|
|
3169
|
+
/** Shrink a handle style's radius and stroke for a `compact` handle. */
|
|
3170
|
+
function compactHandleStyle(style) {
|
|
3171
|
+
const { pointRadius, strokeWidth } = style;
|
|
3172
|
+
return {
|
|
3173
|
+
...style,
|
|
3174
|
+
...pointRadius !== void 0 && { pointRadius: pointRadius * COMPACT_HANDLE_SCALE },
|
|
3175
|
+
...strokeWidth !== void 0 && { strokeWidth: strokeWidth * COMPACT_HANDLE_SCALE }
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3114
3178
|
/**
|
|
3115
3179
|
* Midpoint of the segment between two positions, in lonLat. The single source
|
|
3116
3180
|
* for "where a midpoint handle sits": `buildHandleSet` places the handle here
|
|
@@ -3196,7 +3260,8 @@ function handleStyleFor(kind, interactionStyle, unset = false) {
|
|
|
3196
3260
|
*/
|
|
3197
3261
|
function toFeatures(handles, featureIdPrefix, interactionStyle) {
|
|
3198
3262
|
return handles.map((handle) => {
|
|
3199
|
-
const
|
|
3263
|
+
const slotStyle = handleStyleFor(handle.kind, interactionStyle, handle.unset);
|
|
3264
|
+
const style = slotStyle && handle.compact ? compactHandleStyle(slotStyle) : slotStyle;
|
|
3200
3265
|
return {
|
|
3201
3266
|
type: "Feature",
|
|
3202
3267
|
id: handleFeatureId(featureIdPrefix, handle.kind, handle.index),
|
|
@@ -4555,6 +4620,11 @@ function runEdit(opts) {
|
|
|
4555
4620
|
iconResources: []
|
|
4556
4621
|
}]);
|
|
4557
4622
|
}
|
|
4623
|
+
/** Live view scale for option handles behind pixel-authored sizes. */
|
|
4624
|
+
function optionHandleContext() {
|
|
4625
|
+
const resolution = adapter.getResolution();
|
|
4626
|
+
return hasUsableResolution(resolution) ? { constructionMetersPerCssPixel: resolution } : {};
|
|
4627
|
+
}
|
|
4558
4628
|
function buildCurrentHandleSet() {
|
|
4559
4629
|
const handles = buildHandleSet(workingPoints, modes, {
|
|
4560
4630
|
includeMidpoints: midpointHandlesEnabled,
|
|
@@ -4563,7 +4633,10 @@ function runEdit(opts) {
|
|
|
4563
4633
|
closedRing
|
|
4564
4634
|
});
|
|
4565
4635
|
if (modes.includes("reshape")) {
|
|
4566
|
-
const optionHandles = getControlMeasureOptionHandles(measure.kind, workingPoints, workingOptions, {
|
|
4636
|
+
const optionHandles = getControlMeasureOptionHandles(measure.kind, workingPoints, workingOptions, {
|
|
4637
|
+
detail: detailHandles,
|
|
4638
|
+
...optionHandleContext()
|
|
4639
|
+
});
|
|
4567
4640
|
for (let index = 0; index < optionHandles.length; index++) {
|
|
4568
4641
|
const handle = optionHandles[index];
|
|
4569
4642
|
handles.push({
|
|
@@ -4571,7 +4644,8 @@ function runEdit(opts) {
|
|
|
4571
4644
|
index,
|
|
4572
4645
|
optionId: handle.id,
|
|
4573
4646
|
position: [...handle.position],
|
|
4574
|
-
...handle.unset ? { unset: true } : {}
|
|
4647
|
+
...handle.unset ? { unset: true } : {},
|
|
4648
|
+
...handle.compact ? { compact: true } : {}
|
|
4575
4649
|
});
|
|
4576
4650
|
}
|
|
4577
4651
|
}
|
|
@@ -5092,7 +5166,7 @@ function runEdit(opts) {
|
|
|
5092
5166
|
let activeDrag = null;
|
|
5093
5167
|
let activeOptionDrag = null;
|
|
5094
5168
|
function optionsForOptionHandle(position, drag) {
|
|
5095
|
-
const patch = dragControlMeasureOptionHandle(measure.kind, workingPoints, drag.preDragOptions, drag.handleId, position);
|
|
5169
|
+
const patch = dragControlMeasureOptionHandle(measure.kind, workingPoints, drag.preDragOptions, drag.handleId, position, optionHandleContext());
|
|
5096
5170
|
return patch ? {
|
|
5097
5171
|
...drag.preDragOptions ?? {},
|
|
5098
5172
|
...patch
|
|
@@ -5217,7 +5291,7 @@ function runEdit(opts) {
|
|
|
5217
5291
|
return;
|
|
5218
5292
|
}
|
|
5219
5293
|
if (hit.kind === "option" && hit.optionId && info?.altKey) {
|
|
5220
|
-
const patch = resetControlMeasureOptionHandle(measure.kind, workingPoints, workingOptions, hit.optionId);
|
|
5294
|
+
const patch = resetControlMeasureOptionHandle(measure.kind, workingPoints, workingOptions, hit.optionId, optionHandleContext());
|
|
5221
5295
|
if (patch) {
|
|
5222
5296
|
setOptions(patch, "gesture", "Reset option handle");
|
|
5223
5297
|
shell.suppressNextClickAway();
|
|
@@ -9350,4 +9424,4 @@ function nearestWorldCopyPosition(position, refLng) {
|
|
|
9350
9424
|
return [nearestWorldCopyLng(position[0], refLng), ...position.slice(1)];
|
|
9351
9425
|
}
|
|
9352
9426
|
//#endregion
|
|
9353
|
-
export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, HATCH_PATTERNS, ImageCapabilityRequiredError, MINE_PATTERN_TILE_SIZE, PinPresentationStore, PointSymbolCapabilityRequiredError, PointerCallbackHub, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMinePattern, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, parseColor, pickHitTolerance, pickPointerType, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic };
|
|
9427
|
+
export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, HATCH_PATTERNS, ImageCapabilityRequiredError, MINE_PATTERN_TILE_SIZE, PinPresentationStore, PointSymbolCapabilityRequiredError, PointerCallbackHub, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMinePattern, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic };
|
|
@@ -42,16 +42,42 @@ interface PinPresentation {
|
|
|
42
42
|
radius: number;
|
|
43
43
|
opacity: number;
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* View-wide zoom-out shrinking of the screen-space pin (symbol, plate, halos,
|
|
47
|
+
* dot and screen lift; stem width stays constant). Below `fullSizeZoom` the
|
|
48
|
+
* pin is multiplied by `falloff` per zoom level; `sizeLimits` sets the floor.
|
|
49
|
+
*/
|
|
50
|
+
zoomScale: {
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
fullSizeZoom: number;
|
|
53
|
+
falloff: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* View-wide perspective sizing: pins nearer the camera than the view center
|
|
57
|
+
* grow and farther ones shrink, by `(centerDepth / pinDepth) ^ strength`
|
|
58
|
+
* (1 = true perspective). Multiplies with `zoomScale`; scales the same parts.
|
|
59
|
+
*/
|
|
60
|
+
distanceScale: {
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
strength: number;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* View-wide bounds on the pin scale (zoom × distance), applied only while either
|
|
66
|
+
* scaling mode is enabled: the one place that decides how small or large pins get.
|
|
67
|
+
* If `minScale` exceeds `maxScale`, `maxScale` wins.
|
|
68
|
+
*/
|
|
69
|
+
sizeLimits: {
|
|
70
|
+
minScale: number;
|
|
71
|
+
maxScale: number;
|
|
72
|
+
};
|
|
45
73
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
plate?: Partial<PinPresentation["plate"]>;
|
|
52
|
-
};
|
|
74
|
+
/** Nested settings, merged key by key rather than replaced by a patch. */
|
|
75
|
+
declare const sections: readonly ["stem", "dot", "halo", "symbolHalo", "plate", "zoomScale", "distanceScale", "sizeLimits"];
|
|
76
|
+
type PinSection = (typeof sections)[number];
|
|
77
|
+
declare const viewWideKeys: readonly ["mode", "occlusion", "prioritizePins", "depthSort", "zoomScale", "distanceScale", "sizeLimits"];
|
|
78
|
+
type PinPresentationPatch = Partial<Omit<PinPresentation, PinSection>> & { [K in PinSection]?: Partial<PinPresentation[K]> };
|
|
53
79
|
/** Per-unit appearance and dimensions; spatial rules belong to the view. */
|
|
54
|
-
type PinOverridePatch = Omit<PinPresentationPatch,
|
|
80
|
+
type PinOverridePatch = Omit<PinPresentationPatch, (typeof viewWideKeys)[number]>;
|
|
55
81
|
interface PinPresentationState {
|
|
56
82
|
defaults: PinPresentationPatch;
|
|
57
83
|
overrides: Record<string, PinOverridePatch>;
|
|
@@ -84,6 +110,25 @@ interface PinFootprint {
|
|
|
84
110
|
max: PixelCoordinate;
|
|
85
111
|
}
|
|
86
112
|
declare const DEFAULT_PIN_PRESENTATION: Readonly<PinPresentation>;
|
|
113
|
+
/**
|
|
114
|
+
* Multiplier for screen-space pin dimensions at `zoom`, never above 1; 1 when zoom
|
|
115
|
+
* scaling is off. Unbounded below: combinePinScale applies `sizeLimits`.
|
|
116
|
+
*/
|
|
117
|
+
declare function pinZoomScale(presentation: PinPresentation, zoom: number): number;
|
|
118
|
+
/**
|
|
119
|
+
* Perspective multiplier for a pin at camera depth `depth` (clip-space w), relative
|
|
120
|
+
* to the view center at `referenceDepth`; 1 when distance scaling is off. Unbounded:
|
|
121
|
+
* combinePinScale applies `sizeLimits`. Engines that scale on the GPU must mirror
|
|
122
|
+
* this formula in their shader.
|
|
123
|
+
*/
|
|
124
|
+
declare function pinDistanceScale(presentation: PinPresentation, depth: number, referenceDepth: number): number;
|
|
125
|
+
/**
|
|
126
|
+
* Combined screen-space pin scale from the two mode factors (as returned by
|
|
127
|
+
* pinZoomScale and pinDistanceScale), bounded by `sizeLimits` while either mode is
|
|
128
|
+
* enabled; if its `minScale` exceeds `maxScale`, `maxScale` wins. Engines that
|
|
129
|
+
* scale on the GPU must mirror this in their shader.
|
|
130
|
+
*/
|
|
131
|
+
declare function combinePinScale(presentation: PinPresentation, zoomScale: number, distanceScale: number): number;
|
|
87
132
|
/**
|
|
88
133
|
* Whether `value` is an acceptable number for the pin setting named `key`.
|
|
89
134
|
* Exported so a host's input handling can reject a value with the same rules
|
|
@@ -515,4 +560,4 @@ interface MapAdapter {
|
|
|
515
560
|
getLayerFeatures(layerId: LayerId): readonly Feature[];
|
|
516
561
|
}
|
|
517
562
|
//#endregion
|
|
518
|
-
export { PinOverridePatch as A,
|
|
563
|
+
export { PinOverridePatch as A, isValidPinNumber as B, makeFillPatternImage as C, PointerEventInfo as D, PointerCallback as E, PinPresentationStatus as F, pinZoomScale as H, PinPresentationStatusEvent as I, PinPresentationStore as L, PinPresentationCapability as M, PinPresentationPatch as N, DEFAULT_PIN_PRESENTATION as O, PinPresentationState as P, PinRender as R, isMinePattern as S, EditPointerDriver as T, resolvePinPresentation as U, pinDistanceScale as V, HatchPattern as _, LayerId as a, fillPatternImageDimension as b, MapEvent as c, PickHandler as d, PickOptions as f, HATCH_PATTERNS as g, TextStyleOptions as h, ImageOverlayResource as i, PinPresentation as j, PinFootprint as k, MapEventHandler as l, StyleOptions as m, HandleStyle as n, MapAdapter as o, PixelCoordinate as p, IconResource as r, MapCursor as s, FeatureGroup as t, PickEvent as u, MINE_PATTERN_TILE_SIZE as v, parseColor as w, fillPatternImageId as x, Rgba as y, combinePinScale 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-B8zVKzWH.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.13.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.31.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vitest": ">=4.0.0"
|