Skip to content

Commit

Permalink
vis: TopologyView: adjust node packing logic (#1624)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 authored Apr 5, 2024
1 parent 44aa6a5 commit 21bf04e
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/ott-vis-panel/src/components/views/TopologyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,11 @@ export const TopologyView: React.FC<TopologyViewProps> = ({

let balancerYs = 0;
for (const tree of region.balancerTrees) {
const shouldPack = tree.leaves().length > 6;
const radius = calcGoodTreeRadius(
tree,
shouldPack ? clientNodeRadius / 2 : clientNodeRadius,
shouldPack ? 0 : 4
);
let radius = calcGoodTreeRadius(tree, clientNodeRadius, 4);
const shouldPack = radius > 200;
if (shouldPack) {
radius = calcGoodTreeRadius(tree, clientNodeRadius / 2, 0);
}
const layout = d3.tree<TreeNode>().size([-Math.PI, radius]);
layout(tree);
// precompute radial coordinates
Expand Down Expand Up @@ -266,11 +265,11 @@ export const TopologyView: React.FC<TopologyViewProps> = ({
}
let monolithYs = 0;
for (const tree of region.monolithTrees) {
const shouldPack = tree.leaves().length > 6;
const radius = calcGoodTreeRadius(
tree,
shouldPack ? baseNodeRadius / 2 : baseNodeRadius
);
let radius = calcGoodTreeRadius(tree, baseNodeRadius);
const shouldPack = radius > 200;
if (shouldPack) {
radius = calcGoodTreeRadius(tree, baseNodeRadius / 2);
}
const layout = d3.tree<TreeNode>().size([Math.PI, radius]);
layout(tree);
// precompute radial coordinates
Expand Down

0 comments on commit 21bf04e

Please sign in to comment.