Skip to content

Commit

Permalink
vis: TopologyView: fix subtree layouts sometimes overlapping
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 committed Apr 8, 2024
1 parent 764cc05 commit d6f8256
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/ott-vis-panel/src/components/views/TopologyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ export const TopologyView: React.FC<TopologyViewProps> = ({
const monolithSubtrees: Subtree[] = [];
const balancerSubtrees: Subtree[] = [];

let balancerYs = 0;
for (const tree of region.balancerTrees) {
let radius = calcGoodTreeRadius(tree, clientNodeRadius, 4);
const shouldPack = radius > 200;
Expand All @@ -261,13 +260,14 @@ export const TopologyView: React.FC<TopologyViewProps> = ({
tree,
bbox,
x: -100,
y: balancerYs,
y: 0,
});
const [_left, top, _right, bottom] = bbox;
const height = bottom - top;
balancerYs += height + subtreePadding;
}
let monolithYs = 0;
const balancerYs = stackBoxes(balancerSubtrees.map(t => t.bbox), baseNodeRadius * 2 + 10);
for (const [i, subtree] of balancerSubtrees.entries()) {
subtree.y = balancerYs[i];
}

for (const tree of region.monolithTrees) {
let radius = calcGoodTreeRadius(tree, baseNodeRadius);
const shouldPack = radius > 200;
Expand All @@ -294,11 +294,12 @@ export const TopologyView: React.FC<TopologyViewProps> = ({
tree,
bbox,
x: 100,
y: monolithYs,
y: 0,
});
const [_left, top, _right, bottom] = bbox;
const height = bottom - top;
monolithYs += height + subtreePadding;
}
const monolithYs = stackBoxes(monolithSubtrees.map(t => t.bbox), baseNodeRadius * 2 + 10);
for (const [i, subtree] of monolithSubtrees.entries()) {
subtree.y = monolithYs[i];
}

const built: Region = {
Expand Down

0 comments on commit d6f8256

Please sign in to comment.