[core] Localize and simplify state for MapChangeDidFinishLoadingMap event

Only Map needs to track this state, and it can simply be set when beginning to load a style and reset when finished.
This commit is contained in:
John Firebaugh
2016-03-29 16:07:10 -07:00
parent 7c036fb618
commit 7b5a1ca167
4 changed files with 5 additions and 8 deletions

View File

@@ -78,8 +78,8 @@ void Map::renderSync() {
} else if (renderState != RenderState::fully) {
renderState = RenderState::fully;
view.notifyMapChange(MapChangeDidFinishRenderingMapFullyRendered);
if (data->loading) {
data->loading = false;
if (loading) {
loading = false;
view.notifyMapChange(MapChangeDidFinishLoadingMap);
}
}
@@ -101,11 +101,13 @@ void Map::update(Update flags) {
#pragma mark - Style
void Map::setStyleURL(const std::string &url) {
loading = true;
view.notifyMapChange(MapChangeWillStartLoadingMap);
context->invoke(&MapContext::setStyleURL, url);
}
void Map::setStyleJSON(const std::string& json, const std::string& base) {
loading = true;
view.notifyMapChange(MapChangeWillStartLoadingMap);
context->invoke(&MapContext::setStyleJSON, json, base);
}