[core] [android] Fix InfoWindow topOffsetPixels adjustment when switching styles

Fixes #2599
Make getTopOffsetPixelsForAnnotationSymbol private
Also implements MapChangeWillStartLoadingMap, MapChangeDidFinishLoadingMap
Paritally implements #630
This commit is contained in:
Leith Bade
2015-10-12 10:56:41 +11:00
parent 4ea8e4bc0a
commit 2ee7b02189
9 changed files with 109 additions and 49 deletions

View File

@@ -92,10 +92,6 @@ void MapContext::triggerUpdate(const TransformState& state, const Update flags)
}
void MapContext::setStyleURL(const std::string& url) {
if (styleURL == url) {
return;
}
FileSource* fs = util::ThreadContext::getFileSource();
if (styleRequest) {
@@ -120,15 +116,12 @@ void MapContext::setStyleURL(const std::string& url) {
loadStyleJSON(res.data, base);
} else {
Log::Error(Event::Setup, "loading style failed: %s", res.message.c_str());
data.loading = false;
}
});
}
void MapContext::setStyleJSON(const std::string& json, const std::string& base) {
if (styleJSON == json) {
return;
}
styleURL.clear();
styleJSON = json;
@@ -146,6 +139,10 @@ void MapContext::loadStyleJSON(const std::string& json, const std::string& base)
// force style cascade, causing all pending transitions to complete.
style->cascade();
// set loading here so we don't get a false loaded event as soon as map is
// created but before a style is loaded
data.loading = true;
updateFlags |= Update::DefaultTransition | Update::Classes | Update::Zoom | Update::Annotations;
asyncUpdate->send();
}