@asymmetric-effort/specifyjs 0.2.158 → 0.2.160
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.
|
@@ -17593,15 +17593,29 @@ function findContainerAtPoint(collection, x, y, excludeId) {
|
|
|
17593
17593
|
const descendants = collectDescendantContainerIds(collection, excludeId);
|
|
17594
17594
|
for (const id of descendants) excluded.add(id);
|
|
17595
17595
|
}
|
|
17596
|
-
|
|
17597
|
-
|
|
17598
|
-
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
|
|
17596
|
+
let bestMatch = null;
|
|
17597
|
+
let bestDepth = -1;
|
|
17598
|
+
const stack = [[collection, 0, 0, 0]];
|
|
17599
|
+
while (stack.length > 0) {
|
|
17600
|
+
const [items, offsetX, offsetY, depth] = stack.pop();
|
|
17601
|
+
for (let i = 0; i < items.length; i++) {
|
|
17602
|
+
const item = items[i];
|
|
17603
|
+
if (!isContainer(item)) continue;
|
|
17604
|
+
if (excluded.has(item.container_id)) continue;
|
|
17605
|
+
const absX = item.position.x + offsetX;
|
|
17606
|
+
const absY = item.position.y + offsetY;
|
|
17607
|
+
if (x >= absX && x <= absX + item.size.width && y >= absY && y <= absY + item.size.height) {
|
|
17608
|
+
if (depth > bestDepth) {
|
|
17609
|
+
bestMatch = item.container_id;
|
|
17610
|
+
bestDepth = depth;
|
|
17611
|
+
}
|
|
17612
|
+
if (item.contents.length > 0) {
|
|
17613
|
+
stack.push([item.contents, absX, absY + 30, depth + 1]);
|
|
17614
|
+
}
|
|
17615
|
+
}
|
|
17602
17616
|
}
|
|
17603
17617
|
}
|
|
17604
|
-
return
|
|
17618
|
+
return bestMatch;
|
|
17605
17619
|
}
|
|
17606
17620
|
function snapToGrid(pos, gridSize) {
|
|
17607
17621
|
return {
|
|
@@ -19,9 +19,11 @@ export interface BoardProps {
|
|
|
19
19
|
}) => void;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Find the
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Find the deepest container whose bounding box contains the given point.
|
|
23
|
+
* Searches the full tree (including nested containers), converting positions
|
|
24
|
+
* to canvas-absolute using accumulated parent offsets.
|
|
25
|
+
* Excludes the dragged item and its descendants to prevent circular nesting.
|
|
26
|
+
* Returns the most deeply nested matching container (most specific target).
|
|
25
27
|
*/
|
|
26
28
|
export declare function findContainerAtPoint(collection: BoardItem[], x: number, y: number, excludeId?: string): string | null;
|
|
27
29
|
export declare function snapToGrid(pos: {
|