convert to functional bounds collection

This commit is contained in:
bymyself
2025-09-09 16:59:51 -07:00
parent db5a68bc69
commit c39cdaf36c

View File

@@ -38,20 +38,16 @@ export function useSelectionToolboxPosition(
visible.value = true
// Get bounds from layout store for all selected items
const allBounds: ReadOnlyRect[] = []
for (const item of selectableItems) {
if (typeof item.id === 'string') {
const layout = layoutStore.getNodeLayoutRef(item.id).value
if (layout) {
allBounds.push([
layout.bounds.x,
layout.bounds.y,
layout.bounds.width,
layout.bounds.height
])
}
}
}
const allBounds: ReadOnlyRect[] = Array.from(selectableItems)
.filter((item) => typeof item.id === 'string')
.map((item) => layoutStore.getNodeLayoutRef(item.id as string).value)
.filter((layout) => layout !== null)
.map((layout) => [
layout.bounds.x,
layout.bounds.y,
layout.bounds.width,
layout.bounds.height
])
// Compute union bounds
const unionBounds = computeUnionBounds(allBounds)