mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
Deduplicate code
This commit is contained in:
parent
3315764951
commit
0dac2b2f1f
@ -493,28 +493,16 @@ class WorkspaceView extends Widget with Persistable with MouseHandler with Hover
|
||||
|
||||
g.setSmallFont()
|
||||
|
||||
val iconBoundsInflate = -(node.bounds.w - 22) / 2
|
||||
g.rect(node.bounds.inflate(-10), RGBAColor(0, 0, 0, 150))
|
||||
g.sprite(port.getIcon, node.bounds.inflate(iconBoundsInflate), port.getColor)
|
||||
drawCenteredConnectionHintLabel(
|
||||
g,
|
||||
node.bounds,
|
||||
port.direction.map(node.directionLabel(_)).getOrElse("Any"),
|
||||
port.getColor
|
||||
)
|
||||
|
||||
newConnectionTarget match {
|
||||
case Some((targetNode, targetPort)) =>
|
||||
g.rect(targetNode.bounds.inflate(-10), RGBAColor(0, 0, 0, 150))
|
||||
g.sprite(targetPort.getIcon, targetNode.bounds.inflate(iconBoundsInflate), targetPort.getColor)
|
||||
drawCenteredConnectionHintLabel(
|
||||
g,
|
||||
targetNode.bounds,
|
||||
targetPort.direction.map(targetNode.directionLabel(_)).getOrElse("Any"),
|
||||
targetPort.getColor
|
||||
)
|
||||
|
||||
case _ =>
|
||||
for ((node, port) <- Some((node, port)) ++ newConnectionTarget) {
|
||||
val iconBoundsInflate = -(node.bounds.w - 22) / 2
|
||||
g.rect(node.bounds.inflate(-10), RGBAColor(0, 0, 0, 150))
|
||||
g.sprite(port.getIcon, node.bounds.inflate(iconBoundsInflate), port.getColor)
|
||||
drawCenteredConnectionHintLabel(
|
||||
g,
|
||||
node.bounds,
|
||||
port.direction.map(node.directionLabel(_)).getOrElse("Any"),
|
||||
port.getColor
|
||||
)
|
||||
}
|
||||
|
||||
g.setNormalFont()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user