Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

radial: Correctly use half of the node node spacing as padding. #957

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ public boolean overlap(final ElkNode node1, final ElkNode node2) {
double y1 = node1.getY() - spacing / 2;
double y2 = node2.getY() - spacing / 2;

double width1 = node1.getWidth() + spacing / 2;
double width2 = node2.getWidth() + spacing / 2;
double height1 = node1.getHeight() + spacing / 2;
double height2 = node2.getHeight() + spacing / 2;
double width1 = node1.getWidth() + spacing;
double width2 = node2.getWidth() + spacing;
double height1 = node1.getHeight() + spacing;
double height2 = node2.getHeight() + spacing;

if ((x1 < x2 + width2 && x2 < x1) && (y1 < y2 + height2 && y2 < y1)) {
// left upper and right lower corner overlap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,17 @@ public void extend(final ElkNode graph, final List<ElkNode> nodes, IElkProgressM
Set<ElkNode> nextLevelNodes = RadialUtil.getNextLevelNodeSet(nodes);
// Calculate the moved distance which is the amount all children and grandchildren have to be moved.
int index = 1;
while (!nextLevelNodes.isEmpty()) {
if (!nextLevelNodes.isEmpty()) {
for(ElkNode nextLevelNode : nextLevelNodes) {
moveNode(nextLevelNode, movedDistance);
}
progressMonitor.logGraph(graph, "Child movement " + index);
nextLevelNodes = RadialUtil.getNextLevelNodeSet(new ArrayList<>(nextLevelNodes));
index++;
}

if (sorter != null) {
sorter.sort(new ArrayList<>(nextLevelNodes));
}
progressMonitor.logGraph(graph, "After ancestor movement");
extend(graph, new ArrayList<>(nextLevelNodes), progressMonitor);
}
}
Expand Down
Loading