in code/richediting/src/main/kotlin/org/fbme/ide/richediting/adapters/fbnetwork/FBConnectionPathPainter.kt [83:118]
fun paint(graphics: Graphics, selected: Boolean) {
val s = myPath.sourcePosition
val t = myPath.targetPosition
val bendPoints = myPath.bendPoints
if (bendPoints.isEmpty()) {
graphics.drawLine(s.x, s.y, t.x, t.y)
} else {
var x1 = s.x
var y1 = s.y
var x2 = (bendPoints[0].x + bendPoints[1].x) / 2
var y2 = (bendPoints[0].y + bendPoints[1].y) / 2
drawCorner(graphics, x1, y1, x2, y2, true, selected)
for (i in 2 until bendPoints.size) {
x1 = x2
y1 = y2
x2 = (bendPoints[i - 1].x + bendPoints[i].x) / 2
y2 = (bendPoints[i - 1].y + bendPoints[i].y) / 2
drawCorner(graphics, x1, y1, x2, y2, i % 2 != 0, selected)
}
x1 = x2
y1 = y2
x2 = t.x
y2 = t.y
drawCorner(graphics, x1, y1, x2, y2, false, selected)
}
val hoverGraphics = graphics.create()
hoverGraphics.color = MPSColors.YELLOW.darker()
if (myCursor == FBConnectionCursor.SOURCE_ENDPOINT) {
val xHover = getSourceHover(s, t, bendPoints)
hoverGraphics.drawLine(s.x, s.y, xHover, s.y)
}
if (myCursor == FBConnectionCursor.TARGET_ENDPOINT) {
val xHover = getTargetHover(s, t, bendPoints)
hoverGraphics.drawLine(t.x, t.y, xHover, t.y)
}
}