Highlighting of wires

When working with a complicated circuit containing many wire connections it can be difficult to see exactly where wires go from A to B.

So I added a feature where all the wires to and from a part are highlighted in orange as the mouse is passed over it.

Highlight Wires

This needed quite a lot of code and the creation of new functions and refactoring of others. Also, I tried a couple of other ways to do it such as placing controls over each pin to make use of the signals of a Control node. Unfortunately, we cannot access the pins as nodes.

It was really difficult and time-consuming to come up with a good way to place these controls over the pins. They ended up being a Contol node with a child ColorRect node. But it caused problems with the operation of making connections to the GraphNode. Especially when zoomed in. Something to do with fighting over the signals I guess.

One of the difficulties was to maintain the precise size of the rectangle of the control since parent nodes try to resize the children.

In the end it was best to simply respond to mouse_entered and mouse_exited signals on the part and give up trying to highlight individual wires.

Highlighting individual wires is possible, but you need to translate the mouse coordinates to the nearest pin location, and then simulate entered and exit conditions. This is how I started out, but it seems very inefficient to me.

Comments Forum

More Devlog entries

Most recent first