Skip to content

Commit

Permalink
Support for topdown scale factor property (#173)
Browse files Browse the repository at this point in the history
* topdown layout scaling info elk-client communication

* routes no layout edges correctly when crossing 1 hierarchy level

Signed-off-by: Max Kasperowski <[email protected]>

---------

Signed-off-by: Max Kasperowski <[email protected]>
Co-authored-by: Niklas Rentz <[email protected]>
  • Loading branch information
Eddykasp and NiklasRentzCAU authored Feb 28, 2024
1 parent 8ac1594 commit a60f1ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class TopDownPreservedProperties implements IPreservedProperties {
*/
@Override
public List<IProperty<?>> getProperties() {
return Arrays.asList(/*CoreOptions.TOP_DOWN_LAYOUT_RENDER_SCALE*/);
return Arrays.asList(CoreOptions.TOPDOWN_SCALE_FACTOR);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,9 @@ private void handleExcludedEdge(final KEdge edge) {
-sourceNode.getInsets().getTop());
}
} else {
sourcePoint.add(sourceNode.getXpos(), sourceNode.getYpos());
// TODO: this probably only works for edges crossing at most one hierarchy level
sourcePoint.add(sourceNode.getXpos() * sourceNode.getProperty(CoreOptions.TOPDOWN_SCALE_FACTOR),
sourceNode.getYpos() * sourceNode.getProperty(CoreOptions.TOPDOWN_SCALE_FACTOR));
}

KPoint sourceKPoint = edge.getSourcePoint();
Expand All @@ -1228,7 +1230,9 @@ private void handleExcludedEdge(final KEdge edge) {

// determine the target point
final KVector targetPoint = toElementBorder(targetNode, targetPort, sourceNode, sourcePort);
targetPoint.add(targetNode.getXpos(), targetNode.getYpos());
// TODO: this probably only works for edges crossing at most one hierarchy level
targetPoint.add(targetNode.getXpos() * targetNode.getParent().getProperty(CoreOptions.TOPDOWN_SCALE_FACTOR),
targetNode.getYpos() * targetNode.getParent().getProperty(CoreOptions.TOPDOWN_SCALE_FACTOR));
if (targetInSource) {
KGraphUtil.toAbsolute(targetPoint, targetNode.getParent());
KGraphUtil.toRelative(targetPoint, sourceNode);
Expand Down

0 comments on commit a60f1ab

Please sign in to comment.