@orbat-mapper/tactical-draw 0.17.0 → 0.17.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 +9 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1493,15 +1493,22 @@ function pixelDistance$1(a, b) {
|
|
|
1493
1493
|
* grip use `tolerance` pixels; body containment is exact (`pointInBox`), so a
|
|
1494
1494
|
* click just outside the box never starts a body drag. Returns `null` when
|
|
1495
1495
|
* nothing matches.
|
|
1496
|
+
*
|
|
1497
|
+
* Inside the box a corner reaches no further than half the shorter
|
|
1498
|
+
* half-extent, so a box smaller than the corners' reach — a small symbol
|
|
1499
|
+
* under a touch tolerance — keeps its middle for the body. Outward a corner
|
|
1500
|
+
* keeps the full tolerance.
|
|
1496
1501
|
*/
|
|
1497
1502
|
function pickBoxHandle(box, pixel, tolerance) {
|
|
1498
1503
|
const corners = boxCorners(box);
|
|
1499
|
-
|
|
1504
|
+
const inside = pointInBox(box, pixel);
|
|
1505
|
+
const reach = inside ? Math.min(tolerance, Math.min(box.halfWidth, box.halfHeight) / 2) : tolerance;
|
|
1506
|
+
for (let i = 0; i < corners.length; i++) if (pixelDistance$1(corners[i], pixel) <= reach) return {
|
|
1500
1507
|
kind: "scale",
|
|
1501
1508
|
index: i
|
|
1502
1509
|
};
|
|
1503
1510
|
if (pixelDistance$1(rotateGripPixel(box), pixel) <= tolerance) return { kind: "rotate" };
|
|
1504
|
-
if (
|
|
1511
|
+
if (inside) return { kind: "body" };
|
|
1505
1512
|
return null;
|
|
1506
1513
|
}
|
|
1507
1514
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbat-mapper/tactical-draw",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.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",
|