Skip to content

Commit ee09a7f

Browse files
committed
Fix bug when estimating arrow positioning.
1 parent 5cd24dc commit ee09a7f

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/main/java/com/brunomnsilva/smartgraph/graphview/SmartGraphEdgeCurve.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ public SmartGraphEdgeCurve(Edge<E, V> edge, SmartGraphVertexNode<V> inbound, Sma
9494
enableListeners();
9595
}
9696

97+
@Override
98+
public void setStyleInline(String css) {
99+
styleProxy.setStyleInline(css);
100+
}
101+
97102
@Override
98103
public void setStyleClass(String cssClass) {
99104
styleProxy.setStyleClass(cssClass);
@@ -219,7 +224,7 @@ public void attachArrow(SmartArrow arrow) {
219224
arrow.getTransforms().add(rotation);
220225

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

src/main/java/com/brunomnsilva/smartgraph/graphview/SmartGraphEdgeLine.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ public class SmartGraphEdgeLine<E, V> extends Line implements SmartGraphEdgeBase
4141

4242
private final Edge<E, V> underlyingEdge;
4343

44-
private final SmartGraphVertexNode inbound;
45-
private final SmartGraphVertexNode outbound;
44+
private final SmartGraphVertexNode<V> inbound;
45+
private final SmartGraphVertexNode<V> outbound;
4646

4747
private SmartLabel attachedLabel = null;
4848
private SmartArrow attachedArrow = null;
4949

5050
/* Styling proxy */
5151
private final SmartStyleProxy styleProxy;
5252

53-
public SmartGraphEdgeLine(Edge<E, V> edge, SmartGraphVertexNode inbound, SmartGraphVertexNode outbound) {
53+
public SmartGraphEdgeLine(Edge<E, V> edge, SmartGraphVertexNode<V> inbound, SmartGraphVertexNode<V> outbound) {
5454
if( inbound == null || outbound == null) {
5555
throw new IllegalArgumentException("Cannot connect null vertices.");
5656
}
@@ -69,7 +69,12 @@ public SmartGraphEdgeLine(Edge<E, V> edge, SmartGraphVertexNode inbound, SmartGr
6969
this.endXProperty().bind(inbound.centerXProperty());
7070
this.endYProperty().bind(inbound.centerYProperty());
7171
}
72-
72+
73+
@Override
74+
public void setStyleInline(String css) {
75+
styleProxy.setStyleInline(css);
76+
}
77+
7378
@Override
7479
public void setStyleClass(String cssClass) {
7580
styleProxy.setStyleClass(cssClass);
@@ -125,9 +130,8 @@ public void attachArrow(SmartArrow arrow) {
125130
arrow.getTransforms().add(rotation);
126131

127132
/* add translation transform to put the arrow touching the circle's bounds */
128-
Translate t = new Translate(- outbound.getRadius(), 0);
133+
Translate t = new Translate(-inbound.getRadius(), 0);
129134
arrow.getTransforms().add(t);
130-
131135
}
132136

133137
@Override

0 commit comments

Comments
 (0)