Board editor: Auto-rebuild planes asynchronously #1159
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
So far, planes had to be rebuilt manually by triggering the corresponding tool button. And then the rebuild blocked the UI thread, which could be several seconds for a large board. Both was quite annoying.
Therefore this PR improves the plane rebuild in various ways:
These conditions ensure that the rebuild is not triggered too often as it is quite CPU intensive (although asynchronous, too much CPU load is still annoying for example due to laptop battery usage or fan noise). Even with these restrictions, the rebuild runs often enough that a manual rebuild should not be needed anymore so I removed the corresponding button from the toolbar (it is still in the main menu to enfore rebuilding all planes, for example in case the partial rebuild skipped planes by mistake).
In addition to these usability improvements, the planes now also create cut-outs for arbitrary polygons and stroke texts on copper layers (previously these objects were ignored and thus possibly flooded/overlapped by planes).
UI
The 700ms idle-time detection makes it very intuitive to draw traces within a plane - just stop mouse movement for a moment to get feedback about the plane clearance:
Notes
I'm not sure if it would make sense to allow disabling these auto-rebuilds by some configuration option (for example to reduce battery usage on a laptop). At the moment I think it's not needed (I don't like unnecessary configuration options as they make things unnecessary complex), especially because the auto-rebuild can be disabled implicitly by hiding all planes.