-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Plan View: Fix polyline/polygon vertex dragging freezing the UI #12959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plan View: Fix polyline/polygon vertex dragging freezing the UI #12959
Conversation
1001e3b to
5252242
Compare
|
Can you take a look at the unit tests? |
|
Also can't really get my local environment to run the tests, the documentation seems to be outdated, from a time when |
|
Ah, interesting. Didn't realize there were perf problems here. The issue is that the pathChanged signal is getting emitted over and over again as you drag. These signals then stack up in the queue causing a massive amount of redraw. There is already code in QGC to handle cases like that. It's used a bunch during mission planning recalc of the waypoint lines. The two methods are in QGCApplication: We should try using addCompressedSignal to register the pathChanged signal as "compressed". By doing this only a single instance of the signal will be in the queue. That would limit the redraws to only when it gets back to the main event loop. Not quite sure if it will work as well as the timer though. Will have to try. @mrschick When the pull that I linked to this finishes building can you try a build from there and see how it works for you in comparison? |
|
Nope the compress signals thing doesn't work because they all get pushed on the main thread and aren't queued. I'll modify it. |
|
The pathChanged signal needs to be a queued connection |
Debounces "pathChanged" emissions to occour on every event loop, instead of every frame. This prevents dragging of very long polylines or large polygons from clogging up the UI code with too many path emissions, which would often completely freeze up QGC.
Too bad 😅 |
5252242 to
9ff16bd
Compare
|
I've gotten the unit test to run on my machine now. I believe the issue that causes them to fail is directly caused by the changes, since the tests expect the signal to be sent synchronously, deferring it breaks that expectation. |
|
I'll take a look at all of this and figure something out. |
|
To fix the unit tests you need to add: After the calls which end up queueing the signals to the next from adjustVertext. This way the signals will flow through before you hit the test code. I'm going to merge this in with the unit test failure and then I'll fix up the test with a separate pull. The current state of this code works better than what we have now. but this will sequence needs a full review to be made to work much better in 5.1. |
|
Thanks for the pull |
Neat! Thanks for the support. |
Description
I've noticed that when dragging the vertices of long polylines or large polygons, the UI would often freeze up completely (to the point of "program is not responding") after a few seconds of lag, and only sometimes recover from that state after tens of seconds.
Managed to fix it by debouncing "pathChanged" emissions to occour on every event loop, instead of every frame, which prevents dragging of such polylines/polygons from clogging up the UI code with too many path emissions.
Test Steps
Try creating Corridor Scan items with many polyline vertices or Survey scans (both basic and circular) covering a large area. Dragging of any polyline/polygon vertex won't cause the UI to freeze up completely, it will at worst lag a bit but always recover when releasing the vertex (unlike before).
Checklist:
Related Issue
Couldn't find any, but it seems more likely than not that this was reported at some time in the past.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.