Skip to content
This repository was archived by the owner on Jul 1, 2026. It is now read-only.

Commit f39224d

Browse files
Center vault connectors on tile icons instead of buttons.
Cost labels below each node were pulling connector endpoints downward; measure .vault-node__tile for both vertical and horizontal links. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 7a3956a commit f39224d

1 file changed

Lines changed: 26 additions & 18 deletions

File tree

src/components/VaultPage.tsx

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,36 +96,44 @@ export function VaultPage({ embeddedInPanel = false, toolbarMount = null }: Vaul
9696
if (!tree) return
9797
const compute = () => {
9898
const base = tree.getBoundingClientRect()
99+
// Measure the tile, not the button (the button also wraps the cost label
100+
// below the tile, which would push connector centers downward).
101+
const tileCenter = (id: string) => {
102+
const el = nodeRefs.current.get(id)
103+
const tile = el?.querySelector<HTMLElement>('.vault-node__tile')
104+
const rect = (tile ?? el)?.getBoundingClientRect()
105+
if (!rect) return null
106+
return {
107+
x: rect.left - base.left + rect.width / 2,
108+
y: rect.top - base.top + rect.height / 2,
109+
}
110+
}
99111
const segs: Segment[] = []
100112
for (const node of nodes) {
101113
if (node.parentId) {
102-
const childEl = nodeRefs.current.get(node.id)
103-
const parentEl = nodeRefs.current.get(node.parentId)
104-
if (childEl && parentEl) {
105-
const c = childEl.getBoundingClientRect()
106-
const p = parentEl.getBoundingClientRect()
114+
const c = tileCenter(node.id)
115+
const p = tileCenter(node.parentId)
116+
if (c && p) {
107117
segs.push({
108118
key: `${node.id}->${node.parentId}`,
109-
cx: c.left - base.left + c.width / 2,
110-
cy: c.top - base.top + c.height / 2,
111-
px: p.left - base.left + p.width / 2,
112-
py: p.top - base.top + p.height / 2,
119+
cx: c.x,
120+
cy: c.y,
121+
px: p.x,
122+
py: p.y,
113123
owned: isNodeOwned(state, node),
114124
})
115125
}
116126
}
117127
if (node.hubId) {
118-
const wingEl = nodeRefs.current.get(node.id)
119-
const hubEl = nodeRefs.current.get(node.hubId)
120-
if (wingEl && hubEl) {
121-
const w = wingEl.getBoundingClientRect()
122-
const h = hubEl.getBoundingClientRect()
128+
const w = tileCenter(node.id)
129+
const h = tileCenter(node.hubId)
130+
if (w && h) {
123131
segs.push({
124132
key: `${node.id}->hub:${node.hubId}`,
125-
cx: w.left - base.left + w.width / 2,
126-
cy: w.top - base.top + w.height / 2,
127-
px: h.left - base.left + h.width / 2,
128-
py: h.top - base.top + h.height / 2,
133+
cx: w.x,
134+
cy: w.y,
135+
px: h.x,
136+
py: h.y,
129137
horizontal: true,
130138
owned: isNodeOwned(state, node),
131139
})

0 commit comments

Comments
 (0)