-
Notifications
You must be signed in to change notification settings - Fork 1k
Map Data checkbox: perhaps use toggle slider instead #5009
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
Map Data checkbox: perhaps use toggle slider instead #5009
Conversation
5f00a0b to
0e1677a
Compare
|
Are you planning to get the changes to |
|
@AntonKhorev Yes. Should I create a separate PR in the https://github.com/openstreetmap/leaflet-osm for it? |
d07bf66 to
d9615c6
Compare
|
I created a PR for the leaflet-osm (openstreetmap/leaflet-osm#38) that needs to be merged before this PR will be, as asynchronous loading part depends on it. |
d9615c6 to
41e6069
Compare
|
This PR is linked to the openstreetmap/leaflet-osm#38. If leaflet-osm PR is not merged, this PR can't be merged. |
41e6069 to
ca019cd
Compare
|
PR was updated to include changes made in the openstreetmap/leaflet-osm#38. As leaflet-osm PR is now merged, this PR can be reviewed and merged. |
|
Now you can check Map Data, wait for the rendering to start then quickly click Map Data 2*n times and watch how data is added then removed then added then removed... n times. While this is happening and Map Data is checked, pan to a different place to get a stream of javascript errors. |
ca019cd to
4b91e79
Compare
|
@AntonKhorev I couldn't reproduce JS errors in the console. But I changed logic and now when user clicks "Map Data" checkbox, previous action is skipped immediately. Therefore, there will be no 2*n loads and errors. When we will be okay with the solution, I'll create a new PR in the leaflet-osm. |
|
If there are no other change requests for this PR, I'll create a new PR for the leaflet-osm to merge changes done in the |
af830a1 to
fca12a2
Compare
|
PR was updated. Branch was synced with master and conflicts were resolved. Also, instead of handling canceling layer loading in the Optimizations for layer rendering were done in openstreetmap/leaflet-osm#43, but still this PR is relevant, because it adds loading spinner for those cases when data is processed by the back end, and also for slower CPUs (for example, when I set |
fca12a2 to
4b1e8f2
Compare
|
PR was updated. |
|
This PR is linked to the openstreetmap/leaflet-osm#47. |
tomhughes
left a comment
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.
This mostly works great - the only issue I can see is that if you enable the data layer and then reload the page then it doesn't enable the spinner while it does the initial page load though it does appear on subsequent map drags.
4b1e8f2 to
3b26551
Compare
3b26551 to
83b42a8
Compare
|
PR was updated. @tomhughes Thank you for the review. Spinner issue on page refresh was fixed. |
|
Thanks for the fix. I think this looks good now. |
|
This PR brought two problems:
2025-03-14.02.59.29.mp4
Both problems arise due to the fact that before that the redrawing of the map was performed only once, after the completion of the removal/adding of objects to the SVG-element of the map. I can agree that the first appearance of the data layer looks beautiful. But the work with the map worsened. |
|
@deevroman Thank you for your feedback. #5799 disabled asynchronous layer loading and, therefore, there shouldn't be any flashes or slow rendering process anymore. |
|
You are right, I thought, it disabled both asynchronous functionalities.
But in terms of redrawing all of the features, when map is moved, there was no change that would impact that behavior. Even after turning asynchronous functionality off, all of the features were still redrawn. Turning asynchronous functionality off will solve flash problem, but redrawing all the features will stay the same. Though, for those who have weaker CPUs (for example when I run performance test on |
|
What do you use to test CPU slowdowns? Test rendering >4k features. Can you give us an example of when the user has time to notice the browser freezing, while making the user guess that they are waiting for rendering, and not downloading data? |
|
For Difference between getting data from server and rendering them is that while getting data, there are no CPU intense tasks and loading icon is shown next to the In the video you can see when rendering data can take long time (full video can't be uploaded because of the limitations of GitHub, in reality it took about 30 seconds to render all elements). In such case, there would be 30 seconds freeze of browser if there was synchronous process. OpenStreetMap.and.16.more.pages.-.Work.-.Microsoft.Edge.2025-03-20.12-19-44.mp4 |
Ah, chromium, got it. 20x slowdown is unrealistic. With this value, I can't move the map normally, even without the data layer. But even with 20x slowdown, the layer with 11k features is drawn in 4 seconds when rendered synchronously on my PC.
This is not true because synchronous rendering is faster than asynchronous rendering. In general, I will most likely suggest a PR that disables asynchrony. |
This PR addresses "Map Data checkbox: perhaps use toggle slider instead" issue mentioned in the #4931
Several changes were made to the data loading functionality:
Connected to the PR openstreetmap/leaflet-osm#38
Fixes #4931
Videos:
Loading Video
OpenStreetMap.and.33.more.pages.-.Work.-.Microsoft.Edge.2024-07-25.11-51-38.mp4
Render Video
OpenStreetMap.and.28.more.pages.-.Work.-.Microsoft.Edge.2024-07-20.16-55-01.mp4
Remove Video
OpenStreetMap.and.28.more.pages.-.Work.-.Microsoft.Edge.2024-07-20.16-56-42.mp4