Skip to content

chore: refactor initCenter and controls ordering #1716

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

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

yohanboniface
Copy link
Member

We had an issue (not in Github :p) where a map was not loading because the defaultView was set to "data", and the layers were remote data layers. In this case, when computing the remote URL, we allow to replace georelated variables (like east, west, north, lat…), which needs the map to have a view.
So:

  • the default view was expecting the data to be loaded (="data")
  • the data to be loaded needed a default view…

So instead of adding yet another call to _setDefaultView in an edge case, we reordered the way we initialize the map elements:

  • first we initialize the controls (because initCenter needs the locate control to exist)
  • then we call initCenter
  • then we initialize the tile layers (because the miniMap needs it to render itself)
  • then we call renderControls

We had an issue (not in Github :p) where a map was not loading
because the defaultView was set to "data", and the layers were
remote data layers. In this case, when computing the remote URL,
we allow to replace georelated variables (like east, west, north,
lat…), which needs the map to have a view.
So:
- the default view was expecting the data to be loaded (="data")
- the data to be loaded needed a default view…

So instead of adding yet another call to _setDefaultView in an
edge case, we reordered the way we initialize the map elements:

- first we initialize the controls (because initCenter needs the
  locate control to exist)
- then we call initCenter
- then we initialize the tile layers (because the miniMap needs it
  to render itself)
- then we call renderControls
@yohanboniface yohanboniface merged commit c92d241 into master Mar 27, 2024
@yohanboniface yohanboniface deleted the refactor-init-center branch March 27, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants