aluntzer / gtknodes

A GTK-based library to create functional flow graphs with the ability to pass arbitrary data between connected elements.
Other
92 stars 10 forks source link

Strange twitching when moving node too fast #3

Open gavr123456789 opened 4 years ago

gavr123456789 commented 4 years ago

Peek 2020-06-24 11-37

This is not very clearly visible on the GIF, it is better to try it yourself to understand.

aluntzer commented 4 years ago

Are you referring to the update of the mouse pointer relative to the box or the jerkiness in general?

My current solution of the node viewer redraw process is a bit unsatisfactory and not very efficient, because a move of a node within the node viewer canvas requires a complete redraw of the viewport. This is because connection lines between node sockets need to be redrawn every time a connected node is moved around, which means I cannot easily determine damage areas which I can mark as invalid for a more efficient clipped screen update. You can see this if you start the demo with GTK_DEBUG=interactive ./demo and then enable "Show Graphics Updates" in the "Visual" tab.

I can not currently think of a good solution to this issue, unfortunately.

What appears to exaggerate the jerkiness (for me) is mutter/wayland, where full redraws seem slower compared to running on xorg.

gavr123456789 commented 4 years ago

Oh, I'm glad you answered, I was afraid the project was abandoned. Do not pay attention to the fact that the mouse cursor has a lower FPS than everything else, this is a feature of peek recording. I meant that when the nodes move quickly, it seems that they make random movements to the left and right. This is difficult to notice on this screencast.

gavr123456789 commented 4 years ago

Let me give you a little more context. Now I use another very similar library written in Vala - GTK Flow https://youtu.be/fC6BGOwODuo.
But I found some problems with it: 1 2

As you can see from the second GIF, as soon as the Node goes out of bounds, the content of all Nodes for some reason begins to cause update events. I need the ability to display a really large number of nodes without affecting FPS.

aluntzer commented 4 years ago

I came up with this as a solution to implement intuitive GUI interfaces to control independent components such as simulators, actual hardware and bridging devices between communication interfaces for our space astronomy related contributions for ESA missions at the University of Vienna. Since we're booked throughout the next decade, you can expect this to be maintained for a long time :). There just hasn't been much activity lately, because everything we need at this time is working or implemented.

I'll have a look at the coordinate update/placement code, maybe the there's an issue there.

gavr123456789 commented 4 years ago

https://youtu.be/rz8qzYpmVBU I did something similar on Qt, then I drew each link on a separate widget to solve the problem of not updating the entire view surface due to changing lines. In other words, the widgets were both nodes and their connections. Thus, only the line widget needed to be updated when moving.

Also what you think about Vala?

aluntzer commented 4 years ago

I've thought about something like that, but using cairo canvas layers when drawing rather than doing it on a widget basis. However, since all nodes effectively share the same (conceptual) layer, because they could be randomly interconnected, I considered this infeasible. If used as in your video, where groups of elements are used independently, this would make sense tho.

I've never used vala, but I've added vapi generation to the build. Assuming it works and if you come up with a nice demo, I'd be happy to include it.