X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network.ui%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fui%2Fnodes%2FDistrictNetworkEdgeNode.java;h=e724a68dc46b0063e1129ae9d31ba744083416fc;hb=7f3b0d5297006df708f9169e473448ec6f85e211;hp=1c677316a26c167751150d21d290fb33fe53cbbb;hpb=386525ce8e466427df0624a304ebb64df249d1bb;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java index 1c677316..e724a68d 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java @@ -135,10 +135,19 @@ public class DistrictNetworkEdgeNode extends G2DParentNode implements ISelection double centerX = centerPoint.getX(), centerY = centerPoint.getY(); double deltaX = direction.getX(), deltaY = direction.getY(); - double x0 = centerX - l/2 * deltaX + offset * deltaY; - double y0 = centerY - l/2 * deltaY - offset * deltaX; - double x1 = centerX + (l/2 - w) * deltaX + offset * deltaY; - double y1 = centerY + (l/2 - w) * deltaY - offset * deltaX; + // Ensure the line is always rendered on top of the edge + // to prevent overlap with static info rendered below it. + double odx = offset * deltaY; + double ody = offset * deltaX; + if (odx < 0) { + odx = -odx; + ody = -ody; + } + + double x0 = centerX - l/2 * deltaX + ody; + double y0 = centerY - l/2 * deltaY - odx; + double x1 = centerX + (l/2 - w) * deltaX + ody; + double y1 = centerY + (l/2 - w) * deltaY - odx; g2d.draw(new Line2D.Double(x0, y0, x1, y1));