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