Skip to content
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

feat: implement efficient(-ish) change detection for PolygonLayer & PolylineLayer #1904

Merged
merged 8 commits into from
Jun 8, 2024

Conversation

JaffaKetchup
Copy link
Member

@JaffaKetchup JaffaKetchup commented Jun 3, 2024

The main aim of this change is to enable each element to update independently only when required.

The pre-projection and pre-simplification logic have been refactored into their own state which can be mixed in (and is to PolylineLayer and PolygonLayer).

Performance results:

  • There is little overall change (perhaps +<1ms on UI/build)
  • On the stress test, update times have not changed much, but may have increased a bit - as expected
  • It is expected that in many cases, this will improve efficiency of updates, because only the elements that have updated will need to be re-projected and re-simplified
  • TLDR; there should be some overall noticeable change, except for extremely large samples where all elements change at once, where the behaviour can be manually controlled instead (see below) - middle-size and smaller samples where only a couple elements change, or normal usage, should be better off (also see below)

Additionally, this fixes #1894. Unless useDynamicUpdate is disabled, in which case, Keys have been recommended to refresh the widget manually. This approach has been recommended in some cases: see the in-code docs.

The default simplificationTolerance has also been lowered to 0.3. This gives perfectly acceptable performance (very similar to 0.5 as before), but reduced visual artifacts.

…re-project and re-simplify changed `Polygon`s

Fixed bug where changing `Polygon.points` would not cause re-paint
…get and state

Changed initial `simplificationTolerance` to 0.3
@JaffaKetchup JaffaKetchup requested review from mootw and josxha June 3, 2024 20:38
@JaffaKetchup JaffaKetchup merged commit ba17b39 into master Jun 8, 2024
8 checks passed
@JaffaKetchup JaffaKetchup deleted the polygon-layer-update-per-polygon branch June 8, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG] Polygons and Polylines don't update when points modified
2 participants