@orbat-mapper/tactical-draw 0.2.0-alpha.25 → 0.2.0-alpha.26
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 +8 -1
- package/dist/index.mjs +25 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -544,6 +544,12 @@ interface PointSymbolCapability {
|
|
|
544
544
|
}
|
|
545
545
|
declare function isPointSymbol(graphic: unknown): graphic is PointSymbol;
|
|
546
546
|
declare function clonePointSymbol(symbol: PointSymbol): PointSymbol;
|
|
547
|
+
/**
|
|
548
|
+
* Replace a point-symbol size value as a user-driven resize. Ground-size display
|
|
549
|
+
* bounds scale with the value so they continue to constrain zoom changes rather
|
|
550
|
+
* than preventing the resize itself.
|
|
551
|
+
*/
|
|
552
|
+
declare function resizePointSymbolSize(size: PointSymbolSize, value: number): PointSymbolSize;
|
|
547
553
|
//#endregion
|
|
548
554
|
//#region src/graphic.d.ts
|
|
549
555
|
type Graphic = ControlMeasure | PointSymbol;
|
|
@@ -1880,6 +1886,7 @@ interface PointSymbolFootprint {
|
|
|
1880
1886
|
box: TransformBox;
|
|
1881
1887
|
corners: PixelCoordinate[];
|
|
1882
1888
|
}
|
|
1889
|
+
declare function effectivePointSymbolPixelSize(symbol: PointSymbol, resolution: number | undefined): number;
|
|
1883
1890
|
/** Complete rotated logical footprint for selection and transform chrome. */
|
|
1884
1891
|
declare function pointSymbolFootprint(symbol: PointSymbol, render: PointSymbolRender, adapter: Pick<MapAdapter, "getBearing" | "getPixelFromCoordinate" | "getResolution">): PointSymbolFootprint | null;
|
|
1885
1892
|
//#endregion
|
|
@@ -1897,4 +1904,4 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
|
|
|
1897
1904
|
/** `nearestWorldCopyLng` applied to a lon/lat position. */
|
|
1898
1905
|
declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
|
|
1899
1906
|
//#endregion
|
|
1900
|
-
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, type HandleStyle, type IconResource, type InteractionHit, type InteractionStyle, type LayerId, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type NativeEventEntry, type PickEvent, type PickHandler, type PickOptions, 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 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 TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, bindAbortable, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, isPointSymbol, isTacticalDrawAbortError, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, pointSymbolFootprint, resolveGroundTextSizePixels, tryControlMeasureIdFromFeature };
|
|
1907
|
+
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, type HandleStyle, type IconResource, type InteractionHit, type InteractionStyle, type LayerId, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type NativeEventEntry, type PickEvent, type PickHandler, type PickOptions, 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 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 TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, bindAbortable, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, effectivePointSymbolPixelSize, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, isPointSymbol, isTacticalDrawAbortError, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, pointSymbolFootprint, resizePointSymbolSize, resolveGroundTextSizePixels, tryControlMeasureIdFromFeature };
|
package/dist/index.mjs
CHANGED
|
@@ -461,6 +461,28 @@ function isPointSymbol(graphic) {
|
|
|
461
461
|
function clonePointSymbol(symbol) {
|
|
462
462
|
return structuredClone(symbol);
|
|
463
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Replace a point-symbol size value as a user-driven resize. Ground-size display
|
|
466
|
+
* bounds scale with the value so they continue to constrain zoom changes rather
|
|
467
|
+
* than preventing the resize itself.
|
|
468
|
+
*/
|
|
469
|
+
function resizePointSymbolSize(size, value) {
|
|
470
|
+
if (size.unit === "pixels") return {
|
|
471
|
+
value,
|
|
472
|
+
unit: "pixels"
|
|
473
|
+
};
|
|
474
|
+
const scale = value / size.value;
|
|
475
|
+
if (!Number.isFinite(scale) || scale <= 0) return {
|
|
476
|
+
...size,
|
|
477
|
+
value
|
|
478
|
+
};
|
|
479
|
+
return {
|
|
480
|
+
...size,
|
|
481
|
+
value,
|
|
482
|
+
...size.minPixels !== void 0 ? { minPixels: size.minPixels * scale } : {},
|
|
483
|
+
...size.maxPixels !== void 0 ? { maxPixels: size.maxPixels * scale } : {}
|
|
484
|
+
};
|
|
485
|
+
}
|
|
464
486
|
//#endregion
|
|
465
487
|
//#region src/tactical-draw/active-interaction.ts
|
|
466
488
|
/**
|
|
@@ -4134,10 +4156,7 @@ function runGroupTransform(opts) {
|
|
|
4134
4156
|
function buildWorkingPointSymbol(member) {
|
|
4135
4157
|
const symbol = clonePointSymbol(member.graphic);
|
|
4136
4158
|
symbol.position = [...member.workingPoints[0]];
|
|
4137
|
-
symbol.size =
|
|
4138
|
-
...symbol.size,
|
|
4139
|
-
value: member.workingSize
|
|
4140
|
-
};
|
|
4159
|
+
symbol.size = resizePointSymbolSize(symbol.size, member.workingSize);
|
|
4141
4160
|
symbol.rotation = member.workingRotation;
|
|
4142
4161
|
return symbol;
|
|
4143
4162
|
}
|
|
@@ -5010,7 +5029,7 @@ function runPointSymbolEdit(opts) {
|
|
|
5010
5029
|
next.rotation = normalizeRotation(info?.shiftKey ? constrainRotation(rotation) : rotation);
|
|
5011
5030
|
} else {
|
|
5012
5031
|
const distance = Math.hypot(pixel[0] - drag.anchor[0], pixel[1] - drag.anchor[1]);
|
|
5013
|
-
next.size
|
|
5032
|
+
next.size = resizePointSymbolSize(drag.start.size, Math.max(.1, drag.start.size.value * (distance / drag.startDistance)));
|
|
5014
5033
|
}
|
|
5015
5034
|
return next;
|
|
5016
5035
|
};
|
|
@@ -6040,4 +6059,4 @@ function nearestWorldCopyPosition(position, refLng) {
|
|
|
6040
6059
|
return [nearestWorldCopyLng(position[0], refLng), ...position.slice(1)];
|
|
6041
6060
|
}
|
|
6042
6061
|
//#endregion
|
|
6043
|
-
export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, PointSymbolCapabilityRequiredError, PointerCallbackHub, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, bindAbortable, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, isPointSymbol, isTacticalDrawAbortError, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, pointSymbolFootprint, resolveGroundTextSizePixels, tryControlMeasureIdFromFeature };
|
|
6062
|
+
export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, PointSymbolCapabilityRequiredError, PointerCallbackHub, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, bindAbortable, clonePointSymbol, coerceHandleStyle, combineWithHostSignal, effectivePointSymbolPixelSize, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, isPointSymbol, isTacticalDrawAbortError, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, pointSymbolFootprint, resizePointSymbolSize, resolveGroundTextSizePixels, 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.26",
|
|
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",
|