Skip to content

Commit

Permalink
Fix bug when estimating arrow positioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
brunomnsilva committed Mar 17, 2024
1 parent 5cd24dc commit ee09a7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ public SmartGraphEdgeCurve(Edge<E, V> edge, SmartGraphVertexNode<V> inbound, Sma
enableListeners();
}

@Override
public void setStyleInline(String css) {
styleProxy.setStyleInline(css);
}

@Override
public void setStyleClass(String cssClass) {
styleProxy.setStyleClass(cssClass);
Expand Down Expand Up @@ -219,7 +224,7 @@ public void attachArrow(SmartArrow arrow) {
arrow.getTransforms().add(rotation);

/* add translation transform to put the arrow touching the circle's bounds */
Translate t = new Translate(-outbound.getRadius(), 0);
Translate t = new Translate(-inbound.getRadius(), 0);
arrow.getTransforms().add(t);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ public class SmartGraphEdgeLine<E, V> extends Line implements SmartGraphEdgeBase

private final Edge<E, V> underlyingEdge;

private final SmartGraphVertexNode inbound;
private final SmartGraphVertexNode outbound;
private final SmartGraphVertexNode<V> inbound;
private final SmartGraphVertexNode<V> outbound;

private SmartLabel attachedLabel = null;
private SmartArrow attachedArrow = null;

/* Styling proxy */
private final SmartStyleProxy styleProxy;

public SmartGraphEdgeLine(Edge<E, V> edge, SmartGraphVertexNode inbound, SmartGraphVertexNode outbound) {
public SmartGraphEdgeLine(Edge<E, V> edge, SmartGraphVertexNode<V> inbound, SmartGraphVertexNode<V> outbound) {
if( inbound == null || outbound == null) {
throw new IllegalArgumentException("Cannot connect null vertices.");
}
Expand All @@ -69,7 +69,12 @@ public SmartGraphEdgeLine(Edge<E, V> edge, SmartGraphVertexNode inbound, SmartGr
this.endXProperty().bind(inbound.centerXProperty());
this.endYProperty().bind(inbound.centerYProperty());
}


@Override
public void setStyleInline(String css) {
styleProxy.setStyleInline(css);
}

@Override
public void setStyleClass(String cssClass) {
styleProxy.setStyleClass(cssClass);
Expand Down Expand Up @@ -125,9 +130,8 @@ public void attachArrow(SmartArrow arrow) {
arrow.getTransforms().add(rotation);

/* add translation transform to put the arrow touching the circle's bounds */
Translate t = new Translate(- outbound.getRadius(), 0);
Translate t = new Translate(-inbound.getRadius(), 0);
arrow.getTransforms().add(t);

}

@Override
Expand Down

0 comments on commit ee09a7f

Please sign in to comment.