@orbat-mapper/tactical-draw 0.9.0 → 0.9.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.mjs +14 -13
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6983,6 +6983,13 @@ function runPointSymbolEdit(opts) {
|
|
|
6983
6983
|
}
|
|
6984
6984
|
};
|
|
6985
6985
|
const pointerAngle = (pixel, anchor) => Math.atan2(pixel[1] - anchor[1], pixel[0] - anchor[0]);
|
|
6986
|
+
const snapTranslate = (position, fallbackPixel, info) => snap?.({
|
|
6987
|
+
coordinate: position,
|
|
6988
|
+
pixel: driver.toPixel(position) ?? fallbackPixel,
|
|
6989
|
+
interaction: "translate",
|
|
6990
|
+
graphicId: symbol.id,
|
|
6991
|
+
originalEvent: info?.native
|
|
6992
|
+
})?.coordinate ?? position;
|
|
6986
6993
|
const onDown = (pixel, info) => {
|
|
6987
6994
|
if (pinEditing && opts.canRenderPin?.() && !ctx.settled) {
|
|
6988
6995
|
const footprint = adapter.getPinFootprint?.(working.id);
|
|
@@ -7031,11 +7038,13 @@ function runPointSymbolEdit(opts) {
|
|
|
7031
7038
|
};
|
|
7032
7039
|
const transformed = (pixel, info) => {
|
|
7033
7040
|
if (pinDrag) {
|
|
7034
|
-
const
|
|
7035
|
-
|
|
7041
|
+
const attachment = [pinDrag.attachment[0] + pixel[0] - pinDrag.down[0], pinDrag.attachment[1] + pixel[1] - pinDrag.down[1]];
|
|
7042
|
+
const position = adapter.movePinFromPixel?.(working.id, attachment);
|
|
7043
|
+
if (!position) return null;
|
|
7044
|
+
return {
|
|
7036
7045
|
...clonePointSymbol(pinDrag.start),
|
|
7037
|
-
position
|
|
7038
|
-
}
|
|
7046
|
+
position: snapTranslate(position, attachment, info)
|
|
7047
|
+
};
|
|
7039
7048
|
}
|
|
7040
7049
|
if (!drag) return null;
|
|
7041
7050
|
let next = clonePointSymbol(drag.start);
|
|
@@ -7061,15 +7070,7 @@ function runPointSymbolEdit(opts) {
|
|
|
7061
7070
|
return next;
|
|
7062
7071
|
}
|
|
7063
7072
|
if (drag.kind === "body" || drag.kind === "location") {
|
|
7064
|
-
const
|
|
7065
|
-
const anchorPixel = driver.toPixel(unsnappedPosition) ?? pixel;
|
|
7066
|
-
const position = (snap?.({
|
|
7067
|
-
coordinate: unsnappedPosition,
|
|
7068
|
-
pixel: anchorPixel,
|
|
7069
|
-
interaction: "translate",
|
|
7070
|
-
graphicId: symbol.id,
|
|
7071
|
-
originalEvent: info?.native
|
|
7072
|
-
}))?.coordinate ?? unsnappedPosition;
|
|
7073
|
+
const position = snapTranslate(driver.fromPixel([drag.anchor[0] + pixel[0] - drag.down[0], drag.anchor[1] + pixel[1] - drag.down[1]]), pixel, info);
|
|
7073
7074
|
if (drag.kind === "location") return movePointSymbolLocation(next, intrinsic, adapter, position);
|
|
7074
7075
|
next.position = position;
|
|
7075
7076
|
if (next.offset?.placement.mode === "ground") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbat-mapper/tactical-draw",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.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",
|