Skip to content

Commit 5f32997

Browse files
committed
map stuff
1 parent 74123d8 commit 5f32997

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const defaultMargin: DefaultMargin = {
2929
bottom: 70,
3030
};
3131

32-
let stepHeight: number = 0;
3332
const nodeCoords: object = {};
3433
let count: number = 0;
3534
let aspect: number = 1;
@@ -197,25 +196,21 @@ export default function ComponentMap({
197196
setSelectedNode={setSelectedNode}
198197
/>
199198

200-
<svg
201-
ref={containerRef}
202-
width={totalWidth / aspect}
203-
height={(totalHeight + stepHeight) / aspect}
204-
>
199+
<svg ref={containerRef} width={totalWidth / aspect} height={totalHeight / aspect}>
205200
<LinearGradient id='links-gradient' from='#e75e62' to='#f00008' />
206201
<rect
207202
onClick={() => {
208203
hideTooltip();
209204
}}
210-
width={totalWidth / aspect}
211-
height={(totalHeight + stepHeight) / aspect}
205+
width={sizeWidth / aspect}
206+
height={sizeHeight / aspect}
212207
rx={14}
213208
fill='#242529'
214209
/>
215210
<Group transform={`scale(${aspect})`} top={margin.top} left={margin.left}>
216211
<Tree
217212
root={hierarchy(startNode, (d) => (d.isExpanded ? d.children : null))}
218-
size={[sizeWidth / aspect, (sizeHeight + stepHeight) / aspect]}
213+
size={[sizeWidth / aspect, sizeHeight / aspect]}
219214
separation={(a, b) => (a.parent === b.parent ? 1 : 0.5) / a.depth}
220215
>
221216
{(tree) => (
@@ -256,7 +251,7 @@ export default function ComponentMap({
256251
top = node.x;
257252
left = node.y;
258253
}
259-
254+
//setup a nodeCoords Object that will have keys of unique y coordinates and value arrays of all the left and right x coordinates of the nodes on that level
260255
count < nodeList.length
261256
? !nodeCoords[top]
262257
? (nodeCoords[top] = [left - width / 2, left + width / 2])

0 commit comments

Comments
 (0)