Skip to content

Commit 0f48132

Browse files
committed
set minimum node size
1 parent 6a893c4 commit 0f48132

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/app/components/StateRoute/ComponentMap/ComponentMap.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export default function ComponentMap({
204204
setSelectedNode={setSelectedNode}
205205
/>
206206

207-
<svg ref={containerRef} width={totalWidth} height={totalHeight}>
207+
<svg ref={containerRef} width={totalWidth} height={totalHeight + 200}>
208208
{/* <LinearGradient id='root-gradient' from='#e75e62' to='#f00008' /> */}
209209
<LinearGradient id='root-gradient' from='#488689' to='#3c6e71' />
210210
<LinearGradient id='parent-gradient' from='#488689' to='#3c6e71' />
@@ -214,17 +214,17 @@ export default function ComponentMap({
214214
hideTooltip();
215215
}}
216216
width={sizeWidth / aspect}
217-
height={sizeHeight / aspect}
217+
height={sizeHeight / aspect + 200}
218218
rx={14}
219219
/>
220220
<Group transform={`scale(${aspect})`} top={margin.top} left={margin.left}>
221221
<Tree
222222
root={hierarchy(startNode, (d) => (d.isExpanded ? d.children : null))}
223-
size={[sizeWidth / aspect, sizeHeight / aspect]}
223+
size={[sizeWidth / aspect, sizeHeight / aspect + 50]}
224224
separation={(a, b) => (a.parent === b.parent ? 0.5 : 0.5) / a.depth}
225225
>
226226
{(tree) => (
227-
<Group top={origin.y + 25} left={origin.x}>
227+
<Group top={origin.y + 35} left={origin.x + 50 / aspect}>
228228
{tree.links().map((link, i) => (
229229
<LinkComponent
230230
className='compMapLink'
@@ -327,7 +327,7 @@ export default function ComponentMap({
327327
}
328328
}
329329
} else {
330-
null;
330+
aspect = Math.max(aspect, 0.2);
331331
}
332332

333333
// mousing controls & Tooltip display logic
@@ -425,8 +425,8 @@ export default function ComponentMap({
425425
node.depth === 0
426426
? 'compMapRootText'
427427
: node.children
428-
? 'compMapParentText'
429-
: 'compMapChildText'
428+
? 'compMapParentText'
429+
: 'compMapChildText'
430430
}
431431
dy='.33em'
432432
fontSize='20px'
@@ -440,6 +440,7 @@ export default function ComponentMap({
440440
</Group>
441441
);
442442
})}
443+
{console.log(aspect)}
443444
</Group>
444445
)}
445446
</Tree>

0 commit comments

Comments
 (0)