Skip to content

Commit

Permalink
[868] Compute the position of an edge label when it does not have any
Browse files Browse the repository at this point in the history
Bug: #868
Signed-off-by: Guillaume Coutable <guillaume.coutable@obeo.fr>
  • Loading branch information
gcoutable committed Dec 16, 2021
1 parent beef83c commit 259169a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,20 @@ public void layout(Optional<IDiagramEvent> optionalDiagramElementEvent, DiagramL

// finally we recompute the edges that needs to
for (EdgeLayoutData edge : diagram.getEdges()) {
if (this.hasChanged(edge.getSource()) || this.hasChanged(edge.getTarget())) {
if (this.hasChanged(edge.getSource()) || this.hasChanged(edge.getTarget()) || !this.isLabelPositioned(edge)) {
this.layoutEdge(edge);
}
}
}

private boolean isLabelPositioned(EdgeLayoutData edge) {
if (edge.getCenterLabel() != null) {
Position position = edge.getCenterLabel().getPosition();
return position.getX() != -1 || position.getY() != -1;
}
return false;
}

private void layoutNode(Optional<IDiagramEvent> optionalDiagramElementEvent, NodeLayoutData node, ISiriusWebLayoutConfigurator layoutConfigurator) {
// first layout border & child nodes
for (NodeLayoutData borderNode : node.getBorderNodes()) {
Expand Down

0 comments on commit 259169a

Please sign in to comment.