fleaflet / flutter_map

A versatile mapping package for Flutter. Simple and easy to learn, yet completely customizable and configurable, it's the best choice for mapping in your Flutter app.
https://pub.dev/packages/flutter_map
BSD 3-Clause "New" or "Revised" License
2.74k stars 861 forks source link

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

Closed JaffaKetchup closed 3 months ago

JaffaKetchup commented 4 months ago

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:

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.