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

Change MapStyle #34

Merged
merged 3 commits into from
Apr 16, 2024
Merged

Change MapStyle #34

merged 3 commits into from
Apr 16, 2024

Conversation

hactar
Copy link
Collaborator

@hactar hactar commented Apr 14, 2024

Because we only set the mapStyle during makeUIView, a later change to the styleURL parameter does nothing. This PR adds a check to updateUIView to see if the styleURL changed, and if yes, sets the new URL on the mapView, allowing users to change the mapStyle at runtime (for example to change from a vector to a satellite map style).

@ianthetechie
Copy link
Collaborator

heh... very good catch. I thought I had handled this correctly, but it turns out I was doing a trivially true comparison in the method that actually does the heavy lifting. I'll make some edits + document what's going on better.

@ianthetechie
Copy link
Collaborator

cc @Archdoog I actually found an even better approach after our quick review that's robust to any future style types we introduce. Part of the original reason that this lived in the coordinator was to take advantage of the snapshotting, so I've used that to ensure against unnecessary updates (sometimes the underlying native implementations do dumb things so it's best to just not ask them to change stuff that isn't changed).

@ianthetechie ianthetechie merged commit 1ebefd1 into maplibre:main Apr 16, 2024
2 checks passed
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