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

Changing path visibilty is slow when a lot of paths change state #43

Open
dbrnz opened this issue Sep 16, 2024 · 2 comments
Open

Changing path visibilty is slow when a lot of paths change state #43

dbrnz opened this issue Sep 16, 2024 · 2 comments
Assignees

Comments

@dbrnz
Copy link
Contributor

dbrnz commented Sep 16, 2024

On AC maps there is a noticeable delay (0.5s) when the visibility state of all neuron paths is changed. This appears to be due to a few things:

  1. A single neuron path can consist of more than one line-string features and the visibility state of each feature has to be changed.
  2. Path state is maintained both in a MapLibre layer and the DeckGL layer even though only one of these layers is visible. This is so the correct path state is used when layers are switched.
  3. MapLibre doesn't have a way of disabling rendering while several features change state to then be redrawn together.
  4. This may also be true of DeckGL, although we do have better low level control of its rendering.
@dbrnz dbrnz self-assigned this Sep 16, 2024
@dbrnz dbrnz changed the title Change path visibilty is slow Changing path visibilty is slow when a lot of paths change state Sep 16, 2024
@dbrnz
Copy link
Contributor Author

dbrnz commented Sep 16, 2024

As an example of 1. above, enabling the bolser_12 nerve centreline (on human male), which has the single bolew-unbranched-12 neuron path associated with it, results in 14 features changing state -- 1 feature is the centreline, 13 are the path:

0 {id: 1167, source: 'vector-tiles', sourceLayer: 'whole-human_pathways', children: Array(0)}
1 {id: 7042, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
2 {id: 7043, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
3 {id: 7044, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
4 {id: 7045, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
5 {id: 7046, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
6 {id: 7047, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
7 {id: 7048, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
8 {id: 7049, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
9 {id: 7050, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
10 {id: 7051, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
11 {id: 7052, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
12 {id: 7053, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
13 {id: 7054, source: 'vector-tiles', sourceLayer: 'neural-routes_pathways', children: Array(0)}
14 features changed enabled state...

@dbrnz
Copy link
Contributor Author

dbrnz commented Sep 16, 2024

For the future, maplibre/maplibre-gl-js#4199 should provide a way to control feature visibility (and other styling) without using Map.setFeatureState() and likely be more efficient.

dbrnz added a commit to dbrnz/flatmap-viewer that referenced this issue Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant