@orbat-mapper/tactical-draw 0.27.0 → 0.28.1
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-DDQarsRQ.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
|
|
|
@@ -850,15 +850,26 @@ interface EditSession {
|
|
|
850
850
|
*/
|
|
851
851
|
readonly detailHandles: boolean;
|
|
852
852
|
/**
|
|
853
|
-
* The sub-selected part of a graphic whose definition divides it
|
|
854
|
-
* (`ControlMeasureTopology.partOf`), e.g. the index of the Flow
|
|
855
|
-
* selected flow (ADR-0065)
|
|
856
|
-
*
|
|
857
|
-
* a point or midpoint, or clicking the graphic's body,
|
|
858
|
-
* the pointer, and an edit or undo that removes
|
|
859
|
-
* to `0`.
|
|
853
|
+
* The primary sub-selected part of a graphic whose definition divides it
|
|
854
|
+
* into parts (`ControlMeasureTopology.partOf`), e.g. the index of the Flow
|
|
855
|
+
* Arrow's selected flow (ADR-0065): the part most recently added to
|
|
856
|
+
* [[selectedParts]]. Hosts read it to edit the part's own settings. Starts
|
|
857
|
+
* at `0`; pressing a point or midpoint, or clicking the graphic's body,
|
|
858
|
+
* selects the part under the pointer alone, and an edit or undo that removes
|
|
859
|
+
* the selected part falls back to `0`. Dragging a point or midpoint of a part
|
|
860
|
+
* that is already selected keeps the selection; a click on it without a drag
|
|
861
|
+
* selects it alone. `undefined` for graphics without parts.
|
|
860
862
|
*/
|
|
861
863
|
readonly selectedPart: number | undefined;
|
|
864
|
+
/**
|
|
865
|
+
* Every sub-selected part, [[selectedPart]] included, ascending. Reshape
|
|
866
|
+
* mode shows the option grips of each. Never empty while the graphic has
|
|
867
|
+
* parts; empty for graphics without parts. An edit or undo drops parts the
|
|
868
|
+
* graphic no longer has (promoting the primary if it went), and when the
|
|
869
|
+
* part count changes the set collapses to its primary, since parts are
|
|
870
|
+
* indices and the ones after a removed part shift.
|
|
871
|
+
*/
|
|
872
|
+
readonly selectedParts: readonly number[];
|
|
862
873
|
/**
|
|
863
874
|
* Live size anchor for the measure under edit (ADR-0020). `"ground"` bakes a
|
|
864
875
|
* pixel size to meters on commit; `"screen"` keeps it zoom-aware. Initialised
|
|
@@ -893,17 +904,31 @@ interface EditSession {
|
|
|
893
904
|
*/
|
|
894
905
|
setDetailHandles(visible: boolean): void;
|
|
895
906
|
/**
|
|
896
|
-
* Select
|
|
907
|
+
* Select `part` alone (see [[selectedPart]]), or with `extend` toggle it in
|
|
908
|
+
* or out of [[selectedParts]]: a part toggled in becomes primary; toggling
|
|
909
|
+
* the primary out promotes the most recently added remaining part; toggling
|
|
910
|
+
* out the last part is a no-op. View state only: no change event, no
|
|
897
911
|
* history entry. A no-op for a part the working graphic doesn't have, for
|
|
898
912
|
* graphics without parts, and after settlement.
|
|
899
913
|
*/
|
|
900
|
-
selectPart(part: number
|
|
914
|
+
selectPart(part: number, opts?: {
|
|
915
|
+
extend?: boolean;
|
|
916
|
+
}): void;
|
|
917
|
+
/**
|
|
918
|
+
* Replace [[selectedParts]] (e.g. "All flows"), ignoring parts the graphic
|
|
919
|
+
* doesn't have. `primary`, when it is among them, becomes [[selectedPart]];
|
|
920
|
+
* otherwise the last listed part does. View state only, like
|
|
921
|
+
* [[selectPart]]; a no-op without a valid part.
|
|
922
|
+
*/
|
|
923
|
+
selectParts(parts: readonly number[], primary?: number): void;
|
|
901
924
|
/**
|
|
902
|
-
* Subscribe to
|
|
903
|
-
* the
|
|
904
|
-
*
|
|
925
|
+
* Subscribe to part selection changes, from the pointer, [[selectPart]],
|
|
926
|
+
* [[selectParts]] or the reconcile after an edit or undo. Called once per
|
|
927
|
+
* effective change with the primary and the full set; a call that changes
|
|
928
|
+
* neither doesn't notify. Returns an unsubscribe function; registering
|
|
929
|
+
* after settlement is a no-op.
|
|
905
930
|
*/
|
|
906
|
-
onPartSelect(listener: (part: number | undefined) => void): () => void;
|
|
931
|
+
onPartSelect(listener: (part: number | undefined, parts: readonly number[]) => void): () => void;
|
|
907
932
|
/** Atomically replace the live working graphic while preserving id and kind. */
|
|
908
933
|
updateGraphic(updater: (graphic: ControlMeasure) => ControlMeasure): void;
|
|
909
934
|
/** Shallow-merge per-measure generator options into the live working copy. */
|
package/dist/index.mjs
CHANGED
|
@@ -2745,7 +2745,8 @@ const MODIFIER_KEYS = Object.keys(KEY_PROPS);
|
|
|
2745
2745
|
const DEFAULT_EDIT_MODIFIERS = Object.freeze({
|
|
2746
2746
|
modifierDrag: Object.freeze(["ctrl", "meta"]),
|
|
2747
2747
|
deleteOrReset: "alt",
|
|
2748
|
-
constrain: "shift"
|
|
2748
|
+
constrain: "shift",
|
|
2749
|
+
extendPartSelection: false
|
|
2749
2750
|
});
|
|
2750
2751
|
function checkKey(role, key) {
|
|
2751
2752
|
if (key === false) return false;
|
|
@@ -2754,8 +2755,9 @@ function checkKey(role, key) {
|
|
|
2754
2755
|
}
|
|
2755
2756
|
/**
|
|
2756
2757
|
* Lay `patch` over `base`, validating every key. Throws a `RangeError` for an
|
|
2757
|
-
* unknown key, or when `deleteOrReset` shares a key with `modifierDrag
|
|
2758
|
-
* act on the same vertex press, so
|
|
2758
|
+
* unknown key, or when `deleteOrReset` shares a key with `modifierDrag`, or
|
|
2759
|
+
* `extendPartSelection` with either — they act on the same vertex press, so
|
|
2760
|
+
* one would silently win.
|
|
2759
2761
|
*/
|
|
2760
2762
|
function resolveEditModifiers(base, patch) {
|
|
2761
2763
|
let modifierDrag = base.modifierDrag;
|
|
@@ -2767,13 +2769,23 @@ function resolveEditModifiers(base, patch) {
|
|
|
2767
2769
|
}
|
|
2768
2770
|
const deleteOrReset = patch?.deleteOrReset !== void 0 ? checkKey("deleteOrReset", patch.deleteOrReset) : base.deleteOrReset;
|
|
2769
2771
|
const constrain = patch?.constrain !== void 0 ? checkKey("constrain", patch.constrain) : base.constrain;
|
|
2770
|
-
|
|
2772
|
+
const extendPartSelection = patch?.extendPartSelection !== void 0 ? checkKey("extendPartSelection", patch.extendPartSelection) : base.extendPartSelection;
|
|
2773
|
+
assertNoSharedKey("deleteOrReset", deleteOrReset, "modifierDrag", modifierDrag);
|
|
2774
|
+
assertNoSharedKey("extendPartSelection", extendPartSelection, "modifierDrag", modifierDrag);
|
|
2775
|
+
assertNoSharedKey("extendPartSelection", extendPartSelection, "deleteOrReset", deleteOrReset);
|
|
2771
2776
|
return Object.freeze({
|
|
2772
2777
|
modifierDrag,
|
|
2773
2778
|
deleteOrReset,
|
|
2774
|
-
constrain
|
|
2779
|
+
constrain,
|
|
2780
|
+
extendPartSelection
|
|
2775
2781
|
});
|
|
2776
2782
|
}
|
|
2783
|
+
/** Throw when `role`'s key is also one of `other`'s: both act on the same vertex press. */
|
|
2784
|
+
function assertNoSharedKey(role, key, otherRole, other) {
|
|
2785
|
+
if (!key || other === false) return;
|
|
2786
|
+
if (typeof other === "string" ? other !== key : !other.includes(key)) return;
|
|
2787
|
+
throw new RangeError(`editModifiers: ${role} and ${otherRole} both use "${key}"; they act on the same vertex press, so give them different keys`);
|
|
2788
|
+
}
|
|
2777
2789
|
/** Whether `info` reports any of `keys` held; never when the role is off. */
|
|
2778
2790
|
function modifierHeld(info, keys) {
|
|
2779
2791
|
if (!info || keys === false) return false;
|
|
@@ -4149,30 +4161,74 @@ function samePoints(a, b) {
|
|
|
4149
4161
|
}
|
|
4150
4162
|
function createPartSelection(opts) {
|
|
4151
4163
|
const { topology, isSettled, repaint } = opts;
|
|
4152
|
-
let
|
|
4164
|
+
let order = topology.parts().has(0) ? [0] : [];
|
|
4165
|
+
let partCount = topology.parts().size;
|
|
4166
|
+
let snapshot = freeze(order);
|
|
4153
4167
|
const listeners = createCommitEmitter("EditSession.onPartSelect listener errors");
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4168
|
+
const primary = () => order.at(-1);
|
|
4169
|
+
/** Adopt `next` (in addition order); repaint and notify only if the set or primary changed. */
|
|
4170
|
+
function apply(next, repaintAfter) {
|
|
4171
|
+
const sorted = freeze(next);
|
|
4172
|
+
if (next.at(-1) === primary() && sameParts(sorted, snapshot)) return;
|
|
4173
|
+
order = next;
|
|
4174
|
+
snapshot = sorted;
|
|
4158
4175
|
if (repaintAfter) repaint();
|
|
4159
|
-
listeners.emit(
|
|
4176
|
+
listeners.emit({
|
|
4177
|
+
part: primary(),
|
|
4178
|
+
parts: snapshot
|
|
4179
|
+
});
|
|
4180
|
+
}
|
|
4181
|
+
/** The graphic's parts now; also records the count so `reconcile` doesn't collapse a fresh set. */
|
|
4182
|
+
function currentParts() {
|
|
4183
|
+
const parts = topology.parts();
|
|
4184
|
+
partCount = parts.size;
|
|
4185
|
+
return parts;
|
|
4160
4186
|
}
|
|
4161
4187
|
return {
|
|
4162
4188
|
get selected() {
|
|
4163
|
-
return
|
|
4189
|
+
return primary();
|
|
4190
|
+
},
|
|
4191
|
+
get parts() {
|
|
4192
|
+
return snapshot;
|
|
4193
|
+
},
|
|
4194
|
+
select(part, selectOpts) {
|
|
4195
|
+
if (isSettled() || part === void 0 || !currentParts().has(part)) return;
|
|
4196
|
+
if (!selectOpts?.extend) return apply([part], true);
|
|
4197
|
+
if (!order.includes(part)) return apply([...order, part], true);
|
|
4198
|
+
if (order.length > 1) apply(order.filter((p) => p !== part), true);
|
|
4199
|
+
},
|
|
4200
|
+
selectParts(parts, wanted) {
|
|
4201
|
+
if (isSettled()) return;
|
|
4202
|
+
const valid = currentParts();
|
|
4203
|
+
const next = [...new Set(parts.filter((p) => valid.has(p)))];
|
|
4204
|
+
if (next.length === 0) return;
|
|
4205
|
+
if (wanted !== void 0 && next.includes(wanted)) {
|
|
4206
|
+
next.splice(next.indexOf(wanted), 1);
|
|
4207
|
+
next.push(wanted);
|
|
4208
|
+
}
|
|
4209
|
+
apply(next, true);
|
|
4164
4210
|
},
|
|
4165
|
-
select,
|
|
4166
4211
|
reconcile() {
|
|
4167
|
-
if (
|
|
4168
|
-
|
|
4212
|
+
if (isSettled() || order.length === 0) return;
|
|
4213
|
+
const countBefore = partCount;
|
|
4214
|
+
const valid = currentParts();
|
|
4215
|
+
let next = order.filter((p) => valid.has(p));
|
|
4216
|
+
if (valid.size !== countBefore) next = next.slice(-1);
|
|
4217
|
+
if (next.length === 0 && valid.size > 0) next = [valid.has(0) ? 0 : Math.min(...valid)];
|
|
4218
|
+
apply(next, false);
|
|
4169
4219
|
},
|
|
4170
4220
|
onSelect(listener) {
|
|
4171
4221
|
if (isSettled()) return () => {};
|
|
4172
|
-
return listeners.register(listener);
|
|
4222
|
+
return listeners.register(({ part, parts }) => listener(part, parts));
|
|
4173
4223
|
}
|
|
4174
4224
|
};
|
|
4175
4225
|
}
|
|
4226
|
+
function freeze(parts) {
|
|
4227
|
+
return Object.freeze([...parts].sort((a, b) => a - b));
|
|
4228
|
+
}
|
|
4229
|
+
function sameParts(a, b) {
|
|
4230
|
+
return a.length === b.length && a.every((p, i) => p === b[i]);
|
|
4231
|
+
}
|
|
4176
4232
|
/**
|
|
4177
4233
|
* The part of the segment nearest `pixel` (for a click on the graphic's
|
|
4178
4234
|
* body), or `undefined` when no projectable segment carries a part.
|
|
@@ -5149,6 +5205,15 @@ function runEdit(opts) {
|
|
|
5149
5205
|
let nonGeometryDirty = false;
|
|
5150
5206
|
let dragInFlight = false;
|
|
5151
5207
|
/**
|
|
5208
|
+
* A point or midpoint press whose effect on the part selection waits for
|
|
5209
|
+
* the gesture to turn out a click or a drag: one made with the
|
|
5210
|
+
* `extendPartSelection` key held (a click toggles the part), or a plain
|
|
5211
|
+
* press on a part that is already selected (a click selects it alone, a
|
|
5212
|
+
* drag keeps the selection). A drag of a part outside the selection
|
|
5213
|
+
* selects it alone. See `resolvePressAsDrag`.
|
|
5214
|
+
*/
|
|
5215
|
+
let pendingPress = null;
|
|
5216
|
+
/**
|
|
5152
5217
|
* Mutable style snapshot. Initialised from the edit-start input; replaced
|
|
5153
5218
|
* when the façade routes an external style change to us via
|
|
5154
5219
|
* `notifyExternalMeasure`. `EditSession.measure` stays the immutable
|
|
@@ -5360,7 +5425,7 @@ function runEdit(opts) {
|
|
|
5360
5425
|
})));
|
|
5361
5426
|
const optionHandles = getControlMeasureOptionHandles(measure.kind, workingPoints, workingOptions, {
|
|
5362
5427
|
detail: detailHandles,
|
|
5363
|
-
...parts.selected !== void 0 ? { part: parts.
|
|
5428
|
+
...parts.selected !== void 0 ? { part: parts.parts } : {},
|
|
5364
5429
|
...optionHandleContext()
|
|
5365
5430
|
});
|
|
5366
5431
|
for (let index = 0; index < optionHandles.length; index++) {
|
|
@@ -5821,8 +5886,14 @@ function runEdit(opts) {
|
|
|
5821
5886
|
get selectedPart() {
|
|
5822
5887
|
return parts.selected;
|
|
5823
5888
|
},
|
|
5824
|
-
|
|
5825
|
-
parts.
|
|
5889
|
+
get selectedParts() {
|
|
5890
|
+
return parts.parts;
|
|
5891
|
+
},
|
|
5892
|
+
selectPart(part, selectOpts) {
|
|
5893
|
+
parts.select(part, selectOpts);
|
|
5894
|
+
},
|
|
5895
|
+
selectParts(selected, primary) {
|
|
5896
|
+
parts.selectParts(selected, primary);
|
|
5826
5897
|
},
|
|
5827
5898
|
onPartSelect(listener) {
|
|
5828
5899
|
return parts.onSelect(listener);
|
|
@@ -6088,6 +6159,7 @@ function runEdit(opts) {
|
|
|
6088
6159
|
}
|
|
6089
6160
|
const onDriverDown = (pixel, info) => {
|
|
6090
6161
|
if (ctx.settled || dragInFlight) return;
|
|
6162
|
+
pendingPress = null;
|
|
6091
6163
|
const tol = info?.hitTolerance ?? 12;
|
|
6092
6164
|
if (modes.includes("labeldrag") && labels.onDown(pixel, tol)) {
|
|
6093
6165
|
dragInFlight = true;
|
|
@@ -6109,9 +6181,19 @@ function runEdit(opts) {
|
|
|
6109
6181
|
shell.suppressNextClickAway();
|
|
6110
6182
|
return;
|
|
6111
6183
|
}
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
if (
|
|
6184
|
+
const pressedPart = hit.kind === "vertex" ? topology.partOf(hit.index) : hit.kind === "midpoint" ? hit.segment?.part : void 0;
|
|
6185
|
+
const extend = modifierHeld(info, keys().extendPartSelection);
|
|
6186
|
+
if (pressedPart !== void 0 && (extend || parts.parts.includes(pressedPart))) pendingPress = {
|
|
6187
|
+
part: pressedPart,
|
|
6188
|
+
downPixel: pixel,
|
|
6189
|
+
extend
|
|
6190
|
+
};
|
|
6191
|
+
else parts.select(pressedPart);
|
|
6192
|
+
if (hit.kind === "vertex" && modifierHeld(info, keys().modifierDrag) && startModifierDrag(hit.index, pixel, tol)) {
|
|
6193
|
+
if (pendingPress) parts.select(pendingPress.part);
|
|
6194
|
+
pendingPress = null;
|
|
6195
|
+
return;
|
|
6196
|
+
}
|
|
6115
6197
|
const optionModifier = hit.kind === "option" && modifierHeld(info, keys().modifierDrag);
|
|
6116
6198
|
if (hit.kind === "option" && hit.optionId && deleteOrReset) {
|
|
6117
6199
|
const patch = resetControlMeasureOptionHandle(measure.kind, workingPoints, workingOptions, hit.optionId, optionHandleContext(optionModifier));
|
|
@@ -6281,8 +6363,15 @@ function runEdit(opts) {
|
|
|
6281
6363
|
recomputeDirty();
|
|
6282
6364
|
transient.emit("move", snapshot.points, null);
|
|
6283
6365
|
}
|
|
6366
|
+
/** A pending press turned into a drag: it keeps the selection, or selects an unselected part alone. */
|
|
6367
|
+
function resolvePressAsDrag() {
|
|
6368
|
+
const part = pendingPress.part;
|
|
6369
|
+
pendingPress = null;
|
|
6370
|
+
if (!parts.parts.includes(part)) parts.select(part);
|
|
6371
|
+
}
|
|
6284
6372
|
const onDriverMove = (pixel, info) => {
|
|
6285
6373
|
if (ctx.settled) return;
|
|
6374
|
+
if (pendingPress && !withinClickSlop(pixel, pendingPress.downPixel)) resolvePressAsDrag();
|
|
6286
6375
|
if (labels.dragging) {
|
|
6287
6376
|
const patch = labels.onMove(pixel);
|
|
6288
6377
|
if (patch) {
|
|
@@ -6376,6 +6465,24 @@ function runEdit(opts) {
|
|
|
6376
6465
|
const { fsm, preDragPoints, preDragOptions, controlPointIndex } = activeDrag;
|
|
6377
6466
|
activeDrag = null;
|
|
6378
6467
|
driver.setDragPanEnabled(true);
|
|
6468
|
+
const press = pendingPress;
|
|
6469
|
+
if (press && !withinClickSlop(pixel, press.downPixel)) resolvePressAsDrag();
|
|
6470
|
+
else if (press && !press.extend) {
|
|
6471
|
+
pendingPress = null;
|
|
6472
|
+
parts.select(press.part);
|
|
6473
|
+
} else if (press) {
|
|
6474
|
+
pendingPress = null;
|
|
6475
|
+
deferred.end();
|
|
6476
|
+
replaceWorkingPoints(preDragPoints);
|
|
6477
|
+
workingOptions = preDragOptions;
|
|
6478
|
+
renderWorkingGraphic();
|
|
6479
|
+
recomputeDirty();
|
|
6480
|
+
transient.emit("end", preDragPoints, controlPointIndex);
|
|
6481
|
+
endDragBookkeeping();
|
|
6482
|
+
parts.select(press.part, { extend: true });
|
|
6483
|
+
renderHandlesLayer();
|
|
6484
|
+
return;
|
|
6485
|
+
}
|
|
6379
6486
|
const snapped = snapDrag(pixel, (at) => reshapeTarget(at, info, controlPointIndex));
|
|
6380
6487
|
deferred.finish(releaseDeferred(snapped.pixel, snapped.target), (finalPixel) => {
|
|
6381
6488
|
const next = fsm.end(finalPixel, { constrainAngles: constrainHeld(info) });
|
|
@@ -6449,7 +6556,7 @@ function runEdit(opts) {
|
|
|
6449
6556
|
onMove: onDriverMove,
|
|
6450
6557
|
onUp: onDriverUp,
|
|
6451
6558
|
ownsGraphic: (id) => id === measure.id,
|
|
6452
|
-
onOwnClick: (event) => parts.select(partNearestPixel(event.pixel, topology.segments(), workingPoints, (p) => driver.toPixel(p))),
|
|
6559
|
+
onOwnClick: (event) => parts.select(partNearestPixel(event.pixel, topology.segments(), workingPoints, (p) => driver.toPixel(p)), { extend: eventModifierHeld(event.originalEvent, keys().extendPartSelection) }),
|
|
6453
6560
|
close: () => {
|
|
6454
6561
|
ctx.commit(rebuildRendered);
|
|
6455
6562
|
},
|
|
@@ -244,12 +244,29 @@ interface EditModifiers {
|
|
|
244
244
|
* @default "shift"
|
|
245
245
|
*/
|
|
246
246
|
constrain?: ModifierKey | false;
|
|
247
|
+
/**
|
|
248
|
+
* Click a point, a midpoint or the body of a graphic with parts (e.g. a Flow
|
|
249
|
+
* Arrow's flows) with this key held to toggle that part in or out of the
|
|
250
|
+
* edit session's part selection instead of selecting it alone (see
|
|
251
|
+
* `EditSession.selectedParts`). A drag with the key held is a plain
|
|
252
|
+
* drag, so it may share the `constrain` key (Shift-drag constrains,
|
|
253
|
+
* Shift-click extends). Must not share a key with `modifierDrag` or
|
|
254
|
+
* `deleteOrReset`, which act on the same press. Point and midpoint presses
|
|
255
|
+
* read the key from the edit pointer events; a body click reads it from the
|
|
256
|
+
* engine's click event.
|
|
257
|
+
*
|
|
258
|
+
* Off by default: a host that synthesises the constrain key on every event
|
|
259
|
+
* (to make constraining persistent) would otherwise extend on every click.
|
|
260
|
+
* @default false
|
|
261
|
+
*/
|
|
262
|
+
extendPartSelection?: ModifierKey | false;
|
|
247
263
|
}
|
|
248
264
|
/** {@link EditModifiers} with every role filled in, as `getEditModifiers()` returns it. */
|
|
249
265
|
interface ResolvedEditModifiers {
|
|
250
266
|
modifierDrag: readonly ModifierKey[] | false;
|
|
251
267
|
deleteOrReset: ModifierKey | false;
|
|
252
268
|
constrain: ModifierKey | false;
|
|
269
|
+
extendPartSelection: ModifierKey | false;
|
|
253
270
|
}
|
|
254
271
|
declare const DEFAULT_EDIT_MODIFIERS: ResolvedEditModifiers;
|
|
255
272
|
//#endregion
|
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-DDQarsRQ.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.28.1",
|
|
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.43.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vitest": ">=4.0.0"
|