You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
[core] Several methods assume style object is created #4527
We have several methods that are currently crashing because map.setStyleURL is async. For instance addLayer, addClass, isLoaded and several others. We should have a signal (MapChangeDidFinishLoadingStyle?) emitted right after MapContext::loadStyleJSON.
On Android for instance MapChangeDidFinishLoadingMap is used to indicate that the style was loaded as a whole but we need something to indicate that the style JSON arrived (and the style object was created). Otherwise we might ended up rendering a partial state and later add a custom layer or class.
This new signal would be better implemented after we get rid of the context thread (#2909) because we can safely call view.notifyMapChange from MapContext::loadStyleJSON after that.
Finally, we should maybe throw an runtime exception when calling the methods that depend on a style when the style json is not yet loaded.
I agree with the utility of a notification for this event -- it's style.load in gl-js. I'm less keen on expanding the MapChange enumeration, for reasons detailed in #6383, though I wouldn't block a PR for this on the full refactor suggested there.
Activity
brunoabinader commentedon Mar 31, 2016
Nice catch @tmpsantos - I think it would be useful if we can also add a
onStyleLoadedobserver that could e.g. trigger a callback on the client.1ec5 commentedon Sep 19, 2016
@friedbunny, for iOS/macOS, how does this relate to #2775? Do we need to add a new delegate method, or is an existing one suitable?
friedbunny commentedon Sep 19, 2016
There isn’t currently a suitable delegate method. MapKit doesn’t care to inform you of style loading events, so there’s no analogue to draw upon.
jfirebaugh commentedon Sep 19, 2016
I agree with the utility of a notification for this event -- it's
style.loadin gl-js. I'm less keen on expanding theMapChangeenumeration, for reasons detailed in #6383, though I wouldn't block a PR for this on the full refactor suggested there.