Draw only symbols in bounds #23
Open
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.
Consider this scenario... A user draws a long polyline on a map, say across the whole United States. They add a decorator to the line displaying a marker every 100 pixels. If the user zooms close into the line, thousands of symbols are drawn that are not even visible on the map. This was causing the browser to crash in the app that I'm working on. I noticed that the DOM had thousands of marker DOM nodes in it when zooming in.
With my changes, it seems to increase performance a lot. We keep the cache, but only add the symbols that are in bounds on the map to the DOM. Now instead of having close to 10,000 symbols in the DOM when zoomed in on a long line, I have 10 in my case.