@orbat-mapper/tactical-draw 0.24.0 → 0.26.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 { $ as PinPresentationCapability, A as PointSymbolConnector, B as isPointSymbol, C as makeFillPatternImage, D as PointSymbolAnchor, E as PointSymbol, F as PointSymbolRect, G as ResolvedEditModifiers, H as DEFAULT_EDIT_MODIFIERS, I as PointSymbolRender, J as PointerEventInfo, K as EditPointerDriver, L as PointSymbolSize, M as PointSymbolOffset, N as PointSymbolOffsetStyle, O as PointSymbolCapability, P as PointSymbolPlacement, Q as PinPresentation, R as PointSymbolStyle, S as isMinePattern, T as OffsetDragModifier, U as EditModifiers, V as resizePointSymbolSize, W as ModifierKey, X as PinFootprint, Y as DEFAULT_PIN_PRESENTATION, Z as PinOverridePatch, _ as HatchPattern, a as LayerId, at as PinRender, b as fillPatternImageDimension, c as MapEvent, ct as pinDistanceScale, d as PickHandler, et as PinPresentationPatch, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, it as PinPresentationStore, j as PointSymbolGraphicModifiers, k as PointSymbolColors, l as MapEventHandler, lt as pinZoomScale, m as StyleOptions, n as HandleStyle, nt as PinPresentationStatus, o as MapAdapter, ot as combinePinScale, p as PixelCoordinate, q as PointerCallback, r as IconResource, rt as PinPresentationStatusEvent, s as MapCursor, st as isValidPinNumber, t as FeatureGroup, tt as PinPresentationState, u as PickEvent, ut as resolvePinPresentation, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as clonePointSymbol } from "./map-adapter-
|
|
1
|
+
import { $ as PinPresentationCapability, A as PointSymbolConnector, B as isPointSymbol, C as makeFillPatternImage, D as PointSymbolAnchor, E as PointSymbol, F as PointSymbolRect, G as ResolvedEditModifiers, H as DEFAULT_EDIT_MODIFIERS, I as PointSymbolRender, J as PointerEventInfo, K as EditPointerDriver, L as PointSymbolSize, M as PointSymbolOffset, N as PointSymbolOffsetStyle, O as PointSymbolCapability, P as PointSymbolPlacement, Q as PinPresentation, R as PointSymbolStyle, S as isMinePattern, T as OffsetDragModifier, U as EditModifiers, V as resizePointSymbolSize, W as ModifierKey, X as PinFootprint, Y as DEFAULT_PIN_PRESENTATION, Z as PinOverridePatch, _ as HatchPattern, a as LayerId, at as PinRender, b as fillPatternImageDimension, c as MapEvent, ct as pinDistanceScale, d as PickHandler, et as PinPresentationPatch, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, it as PinPresentationStore, j as PointSymbolGraphicModifiers, k as PointSymbolColors, l as MapEventHandler, lt as pinZoomScale, m as StyleOptions, n as HandleStyle, nt as PinPresentationStatus, o as MapAdapter, ot as combinePinScale, p as PixelCoordinate, q as PointerCallback, r as IconResource, rt as PinPresentationStatusEvent, s as MapCursor, st as isValidPinNumber, t as FeatureGroup, tt as PinPresentationState, u as PickEvent, ut as resolvePinPresentation, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as clonePointSymbol } from "./map-adapter-mmWf_Jig.mjs";
|
|
2
2
|
import { AmplifierPlacement, AmplifierPlacements, ControlMeasure, ControlMeasureKind, ControlMeasureRender, ControlMeasureStyle, HighlightAppearance, LabelFit, SymbolColors, TextAmplifiers } from "@orbat-mapper/control-measures";
|
|
3
3
|
import { Feature, Position } from "geojson";
|
|
4
4
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_HIGHLIGHT_WIDTH, DEFAULT_LABEL_HEIGHT_CSS_PIXELS, DEFAULT_SYMBOL_COLOR, FILL_PATTERN_DEFINITIONS, LABEL_FADE_END_RATIO, NON_SOLID_FILL_PATTERNS, applyBoxTransformOptions, canDeleteControlMeasureVertex, canonicalTextAmplifierKey, cloneControlMeasure, controlMeasureIdFromFeature, dragControlMeasureOptionHandle, foldsBoxTransformOptions, freezeOrientationOptions, getControlMeasureMetadata, getControlMeasureModifierDrag, getControlMeasureOptionHandles, getControlMeasurePartOf, getControlMeasureSegments, getDefaultOptions, labelSizeBandHideThreshold, normalizeTextAmplifiers, remapVertexAlignedOptions, renderControlMeasure, resetControlMeasureOptionHandle, resolveAmplifierPlacement, resolveSizePair, resolveStyleHints, resolveSymbolColor, roundToFixed, switchSizePairUnit } from "@orbat-mapper/control-measures";
|
|
1
|
+
import { DEFAULT_HIGHLIGHT_WIDTH, DEFAULT_LABEL_HEIGHT_CSS_PIXELS, DEFAULT_SYMBOL_COLOR, FILL_PATTERN_DEFINITIONS, LABEL_FADE_END_RATIO, NON_SOLID_FILL_PATTERNS, applyBoxTransformOptions, canDeleteControlMeasureVertex, canonicalTextAmplifierKey, cloneControlMeasure, controlMeasureIdFromFeature, dragControlMeasureOptionHandle, foldsBoxTransformOptions, freezeOrientationOptions, getControlMeasureMetadata, getControlMeasureModifierDrag, getControlMeasureOptionHandles, getControlMeasurePartOf, getControlMeasureSegments, getDefaultOptions, keepControlMeasureDrawnSize, labelSizeBandHideThreshold, normalizeTextAmplifiers, remapVertexAlignedOptions, renderControlMeasure, resetControlMeasureOptionHandle, resolveAmplifierPlacement, resolveSizePair, resolveStyleHints, resolveSymbolColor, roundToFixed, switchSizePairUnit } from "@orbat-mapper/control-measures";
|
|
2
2
|
function pickPointerType(originalEvent) {
|
|
3
3
|
if (typeof PointerEvent !== "undefined" && originalEvent instanceof PointerEvent) {
|
|
4
4
|
if (originalEvent.pointerType === "touch") return "touch";
|
|
@@ -3359,7 +3359,9 @@ function runVariableLengthDraw(options) {
|
|
|
3359
3359
|
if (!rule || ruleMin === void 0) return false;
|
|
3360
3360
|
return len >= trailingFixed + ruleMin;
|
|
3361
3361
|
}
|
|
3362
|
+
const insertAtStart = rule?.insertClicksAtStart ?? false;
|
|
3362
3363
|
function insertionIndex(len) {
|
|
3364
|
+
if (insertAtStart) return 0;
|
|
3363
3365
|
return canonicalFormed(len) ? len - trailingFixed : len;
|
|
3364
3366
|
}
|
|
3365
3367
|
const initialPoints = [];
|
|
@@ -3402,6 +3404,15 @@ function runVariableLengthDraw(options) {
|
|
|
3402
3404
|
if (rule && ruleMin !== void 0 && n - trailingFixed < ruleMin) return false;
|
|
3403
3405
|
return true;
|
|
3404
3406
|
}
|
|
3407
|
+
let sizeBaseline;
|
|
3408
|
+
function updateSizeBaseline() {
|
|
3409
|
+
if (!sizeBaseline && canCommitNow()) sizeBaseline = committed.map((p) => [...p]);
|
|
3410
|
+
}
|
|
3411
|
+
updateSizeBaseline();
|
|
3412
|
+
function drawnOptions(points) {
|
|
3413
|
+
if (!sizeBaseline) return measureOptions;
|
|
3414
|
+
return keepControlMeasureDrawnSize(kind, sizeBaseline, points, measureOptions);
|
|
3415
|
+
}
|
|
3405
3416
|
const session = {
|
|
3406
3417
|
get controlPoints() {
|
|
3407
3418
|
return committed.map((p) => [...p]);
|
|
@@ -3448,7 +3459,7 @@ function runVariableLengthDraw(options) {
|
|
|
3448
3459
|
const handleClick = (event) => {
|
|
3449
3460
|
if (ctx.settled) return;
|
|
3450
3461
|
const pos = roundControlPoint(snappedDrawPosition(snap, event));
|
|
3451
|
-
const lastSpineIdx = committed.length - 1 - trailingFixed;
|
|
3462
|
+
const lastSpineIdx = insertAtStart ? Math.min(0, committed.length - 1) : committed.length - 1 - trailingFixed;
|
|
3452
3463
|
const finishIndices = closedRing && lastSpineIdx > 0 ? [lastSpineIdx, 0] : [lastSpineIdx];
|
|
3453
3464
|
for (let i = 0; i < committed.length; i++) if (positionsEqual(pos, committed[i])) {
|
|
3454
3465
|
if (finishIndices.includes(i) && canCommitNow()) ctx.commit(buildSnapshot);
|
|
@@ -3473,6 +3484,7 @@ function runVariableLengthDraw(options) {
|
|
|
3473
3484
|
committed.splice(0, committed.length, ...derived);
|
|
3474
3485
|
}
|
|
3475
3486
|
committed.splice(0, committed.length, ...roundControlPoints(committed));
|
|
3487
|
+
updateSizeBaseline();
|
|
3476
3488
|
rubberBand = void 0;
|
|
3477
3489
|
renderPreview();
|
|
3478
3490
|
try {
|
|
@@ -3511,7 +3523,7 @@ function runVariableLengthDraw(options) {
|
|
|
3511
3523
|
points.splice(idx, 0, rubberBand);
|
|
3512
3524
|
} else points = [...committed];
|
|
3513
3525
|
if (rule) points = rule.derive(points);
|
|
3514
|
-
const previewFeatures = points.length === 0 ? [] : buildPreviewFeatures(adapter, kind, points,
|
|
3526
|
+
const previewFeatures = points.length === 0 ? [] : buildPreviewFeatures(adapter, kind, points, drawnOptions(points), measureStyle, measureTextAmplifiers, renderOpts);
|
|
3515
3527
|
ctx.writeLayer(previewLayer, [{
|
|
3516
3528
|
id: "__td_variable_draw_preview__",
|
|
3517
3529
|
features: previewFeatures,
|
|
@@ -3533,11 +3545,12 @@ function runVariableLengthDraw(options) {
|
|
|
3533
3545
|
renderPreview();
|
|
3534
3546
|
}
|
|
3535
3547
|
function buildSnapshot() {
|
|
3548
|
+
const committedOptions = drawnOptions(committed);
|
|
3536
3549
|
const sized = withDefaultAuthoringSize(withCommittedAdapterMeasureOptions({
|
|
3537
3550
|
id: generateId(),
|
|
3538
3551
|
kind,
|
|
3539
3552
|
controlPoints: committed.map((p) => [...p]),
|
|
3540
|
-
...
|
|
3553
|
+
...committedOptions !== void 0 ? { options: committedOptions } : {},
|
|
3541
3554
|
...measureStyle !== void 0 ? { style: measureStyle } : {},
|
|
3542
3555
|
...measureProperties !== void 0 ? { properties: measureProperties } : {},
|
|
3543
3556
|
...measureTextAmplifiers !== void 0 ? { textAmplifiers: measureTextAmplifiers } : {}
|
|
@@ -5299,9 +5312,13 @@ function runEdit(opts) {
|
|
|
5299
5312
|
}]);
|
|
5300
5313
|
}
|
|
5301
5314
|
/** Live view scale for option handles behind pixel-authored sizes. */
|
|
5302
|
-
|
|
5315
|
+
/** The live view state for option handles; `modifier` adds the press's modifier-drag key. */
|
|
5316
|
+
function optionHandleContext(modifier = false) {
|
|
5303
5317
|
const resolution = adapter.getResolution();
|
|
5304
|
-
return
|
|
5318
|
+
return {
|
|
5319
|
+
...hasUsableResolution(resolution) ? { constructionMetersPerCssPixel: resolution } : {},
|
|
5320
|
+
...modifier ? { modifier: true } : {}
|
|
5321
|
+
};
|
|
5305
5322
|
}
|
|
5306
5323
|
function buildCurrentHandleSet() {
|
|
5307
5324
|
const handles = buildHandleSet(workingPoints, modes, {
|
|
@@ -5896,7 +5913,7 @@ function runEdit(opts) {
|
|
|
5896
5913
|
if (frame.part !== void 0) parts.select(frame.part);
|
|
5897
5914
|
}
|
|
5898
5915
|
function optionsForOptionHandle(position, drag) {
|
|
5899
|
-
const patch = dragControlMeasureOptionHandle(measure.kind, workingPoints, drag.preDragOptions, drag.handleId, position, optionHandleContext());
|
|
5916
|
+
const patch = dragControlMeasureOptionHandle(measure.kind, workingPoints, drag.preDragOptions, drag.handleId, position, optionHandleContext(drag.modifier));
|
|
5900
5917
|
return patch ? {
|
|
5901
5918
|
...drag.preDragOptions ?? {},
|
|
5902
5919
|
...patch
|
|
@@ -6073,8 +6090,9 @@ function runEdit(opts) {
|
|
|
6073
6090
|
if (hit.kind === "vertex") parts.select(topology.partOf(hit.index));
|
|
6074
6091
|
else if (hit.kind === "midpoint") parts.select(hit.segment?.part);
|
|
6075
6092
|
if (hit.kind === "vertex" && modifierHeld(info, keys().modifierDrag) && startModifierDrag(hit.index, pixel, tol)) return;
|
|
6093
|
+
const optionModifier = hit.kind === "option" && modifierHeld(info, keys().modifierDrag);
|
|
6076
6094
|
if (hit.kind === "option" && hit.optionId && deleteOrReset) {
|
|
6077
|
-
const patch = resetControlMeasureOptionHandle(measure.kind, workingPoints, workingOptions, hit.optionId, optionHandleContext());
|
|
6095
|
+
const patch = resetControlMeasureOptionHandle(measure.kind, workingPoints, workingOptions, hit.optionId, optionHandleContext(optionModifier));
|
|
6078
6096
|
if (patch) {
|
|
6079
6097
|
setOptions(patch, "gesture", "Reset option handle");
|
|
6080
6098
|
shell.suppressNextClickAway();
|
|
@@ -6085,7 +6103,8 @@ function runEdit(opts) {
|
|
|
6085
6103
|
activeOptionDrag = {
|
|
6086
6104
|
handleId: hit.optionId,
|
|
6087
6105
|
preDragOptions: workingOptions,
|
|
6088
|
-
preDragNonGeometryDirty: nonGeometryDirty
|
|
6106
|
+
preDragNonGeometryDirty: nonGeometryDirty,
|
|
6107
|
+
modifier: optionModifier
|
|
6089
6108
|
};
|
|
6090
6109
|
transient.emit("start", workingPoints, null);
|
|
6091
6110
|
dragInFlight = true;
|
|
@@ -227,7 +227,8 @@ interface EditModifiers {
|
|
|
227
227
|
/**
|
|
228
228
|
* Drag a vertex with this key held to hand the gesture to the definition's
|
|
229
229
|
* `modifierDrag` hook (e.g. a Flow Arrow split or merge). Any key in a list
|
|
230
|
-
* starts it.
|
|
230
|
+
* starts it. Held while pressing an option handle, it lets the definition
|
|
231
|
+
* widen that drag or reset (e.g. sizing every Split Arrow head at once).
|
|
231
232
|
* @default ["ctrl", "meta"]
|
|
232
233
|
*/
|
|
233
234
|
modifierDrag?: ModifierKey | readonly ModifierKey[] | false;
|
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-mmWf_Jig.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.26.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.42.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vitest": ">=4.0.0"
|