4
4
#include < mbgl/storage/file_source.hpp>
5
5
#include < mbgl/style/style_impl.hpp>
6
6
#include < mbgl/util/exception.hpp>
7
+ #include < mbgl/actor/scheduler.hpp>
7
8
8
9
namespace mbgl {
9
10
@@ -19,7 +20,9 @@ Map::Impl::Impl(RendererFrontend& frontend_,
19
20
crossSourceCollisions(mapOptions.crossSourceCollisions()),
20
21
fileSource(std::move(fileSource_)),
21
22
style(std::make_unique<style::Style>(*fileSource, pixelRatio)),
22
- annotationManager(*style) {
23
+ annotationManager(*style),
24
+ mailbox(std::make_shared<Mailbox>(*Scheduler::GetCurrent ())),
25
+ actor(*this , mailbox) {
23
26
transform.setNorthOrientation (mapOptions.northOrientation ());
24
27
style->impl ->setObserver (this );
25
28
rendererFrontend.setObserver (*this );
@@ -39,12 +42,16 @@ void Map::Impl::onSourceChanged(style::Source& source) {
39
42
}
40
43
41
44
void Map::Impl::onUpdate () {
42
- // Don't load/render anything in still mode until explicitly requested.
43
- if (mode != MapMode::Continuous && !stillImageRequest) {
44
- return ;
45
+ if (mode == MapMode::Continuous) {
46
+ actor.invoke (&Map::Impl::updateInternal, Clock::now ());
47
+ } else if (stillImageRequest) {
48
+ updateInternal (Clock::time_point::max ());
45
49
}
50
+ }
46
51
47
- TimePoint timePoint = mode == MapMode::Continuous ? Clock::now () : Clock::time_point::max ();
52
+ void Map::Impl::updateInternal (TimePoint timePoint) {
53
+ // Don't load/render anything in still mode until explicitly requested.
54
+ assert (mode == MapMode::Continuous || stillImageRequest);
48
55
49
56
transform.updateTransitions (timePoint);
50
57
0 commit comments