-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
fix: prevent crash when zooming far into Polygon
s
#1854
Conversation
Polygon
s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ReinisSprogis,
I think this works great for polygons, thanks. LGTM!
I've also realised that the same issue occurs with polylines, we'll need to apply the same fix there.
Hi. @JaffaKetchup Yes! I suppose would be better if @monsieurtanuki could look into it as he would navigate better in code he just wrote. |
@ReinisSprogis @JaffaKetchup Sounds reasonable. I have to refactor part of the code into a class. |
Makes sense. Probably relevant specifically for dotted lines, where the dots have little space between them, but should be true for dashed lines too.
To be tested indeed about displaying dots: which is better/faster between
Same performance question for lines ( |
Testing in https://demo.fleaflet.dev/polyline Same lag occurs while zooming in into dashed line and dotted line. Need to draw segment only up to canvas edge. |
@ReinisSprogis @JaffaKetchup I've just found an elegant way to display only what matters. Btw, with this new mehod:
|
…imized rendering New files: * `pixel_hiker.dart`: Pixel hikers that list the visible items on the way. Code used to be in `polyline_layer/painter.dart`, but was heavily refactored with fleaflet#1854 in mind * `visible_segment.dart`: Cohen-Sutherland algorithm to clip segments as visible into a canvas. Code used to be in `polygon_layer/painter.dart`, and was lightly refactored. Impacted files: * `polygon_layer/painter.dart`: now using new file `pixel_hiker.dart` for optimized rendering; moved "clip code" to new file `visible_segment.dart`; minor refactoring about parameter order consistency * `polyline_layer/painter.dart`: now using new file `pixel_hiker.dart` for optimized rendering; moved "pixel hiker" to new file `pixel_hiker.dart` * `pages/polygon.dart`: replaced `bool isDotted` with `PolylinePattern pattern` and in one case replaced it with "dashed" * `polygon_layer/polygon.dart`: BREAKING - replaced `bool isDotted` with `PolylinePattern pattern` * `polygon_layer/polygon_layer.dart`: minor refactoring * `polyline_layer/polyline_layer.dart`: minor refactoring
…imized rendering (#1865) * feat!: support of solid, dotted, dashed styles for polygons, with optimized rendering New files: * `pixel_hiker.dart`: Pixel hikers that list the visible items on the way. Code used to be in `polyline_layer/painter.dart`, but was heavily refactored with #1854 in mind * `visible_segment.dart`: Cohen-Sutherland algorithm to clip segments as visible into a canvas. Code used to be in `polygon_layer/painter.dart`, and was lightly refactored. Impacted files: * `polygon_layer/painter.dart`: now using new file `pixel_hiker.dart` for optimized rendering; moved "clip code" to new file `visible_segment.dart`; minor refactoring about parameter order consistency * `polyline_layer/painter.dart`: now using new file `pixel_hiker.dart` for optimized rendering; moved "pixel hiker" to new file `pixel_hiker.dart` * `pages/polygon.dart`: replaced `bool isDotted` with `PolylinePattern pattern` and in one case replaced it with "dashed" * `polygon_layer/polygon.dart`: BREAKING - replaced `bool isDotted` with `PolylinePattern pattern` * `polygon_layer/polygon_layer.dart`: minor refactoring * `polyline_layer/polyline_layer.dart`: minor refactoring * Renamed `PolylinePattern` to `StrokePattern` Re-organised file structure * Review changes Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com> * Update lib/src/layer/general/line_patterns/stroke_pattern.dart Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com> * Update lib/src/layer/general/line_patterns/pixel_hiker.dart Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com> * Update lib/src/layer/general/line_patterns/stroke_pattern.dart Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com> * Minor file re-organisation * Fixed bug --------- Co-authored-by: JaffaKetchup <github@jaffaketchup.dev> Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com>
fix #1829
Problem was that as zooming in, path was getting very long and many dots was calculated eventually getting into millions and crashing. This resolves it by drawing points only on visible segment. Directly painting circles rather them on path. Thought this might be better. Any suggestions for improvement are welcome. Would appreciate some testing as I haven't done much.