Skip to content

Commit 1bdb521

Browse files
committed
fix(vortex-web): restore treemap header band so strips stop overlapping
The header bars were piling up on top of each other (and on leaf labels) at the top of the map because `.paddingTop(18)` was being overridden: d3's `.paddingOuter(1)` also sets the top pad and was called after it, collapsing the band to 1px. Set `paddingTop` last so each container gets a real 18px band, and lay out PAD_TOP taller with an upward shift so the root's own band doesn't leave a top margin. Strips now sit in their own bands with no overlap. Signed-off-by: Robert <robert@spiraldb.com>
1 parent 3c7dfb6 commit 1bdb521

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

-7.94 KB
Loading
4.71 KB
Loading
5.11 KB
Loading

vortex-web/src/components/explorer/BlockTreemap.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,23 @@ export function BlockTreemap({
185185
.sum((d) => (d.children ? 0 : d.bytes))
186186
.sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
187187
treemap<TreeNode>()
188-
.size([size.w, size.h])
188+
// Lay out PAD_TOP taller; we shift up by PAD_TOP below so the root's own
189+
// header band sits off-screen and top-level fields start flush with y=0.
190+
.size([size.w, size.h + PAD_TOP])
189191
.tile(treemapSquarify)
190-
.paddingTop(PAD_TOP)
191192
.paddingInner(2)
192193
.paddingOuter(1)
194+
// paddingTop MUST come after paddingOuter — paddingOuter also sets the top
195+
// pad, so setting it last would collapse the header band to 1px and make
196+
// nested strips pile up on top of each other.
197+
.paddingTop(PAD_TOP)
193198
.round(true)(r);
194-
return r.descendants() as RectNode[];
199+
const desc = r.descendants() as RectNode[];
200+
for (const n of desc) {
201+
n.y0 -= PAD_TOP;
202+
n.y1 -= PAD_TOP;
203+
}
204+
return desc;
195205
}, [tree, size]);
196206

197207
const byId = useMemo(() => {

0 commit comments

Comments
 (0)