Unify default transition values in MapData

Relevant changes:
 - Added 'defaultFadeDuration' and 'defaultTransitionDelay' to MapData;
 - Painter & StyleParser now receives a reference to MapData;
 - As previously seen on the code: 300ms is the default fade duration
   and 0ms is the default transition duration;
 - We no longer pass the current time point to Style, since it now uses
   MapData.animationTime, which gets updated in MapContext::update().
 - Updated StyleParser check to use a mock MapData;
This commit is contained in:
Bruno de Oliveira Abinader
2015-07-14 15:14:39 +03:00
parent 2aad2f4e14
commit 0ea8a37cb0
14 changed files with 88 additions and 58 deletions

View File

@@ -254,21 +254,15 @@ void MapContext::update() {
return;
}
const TimePoint now = Clock::now();
data.setAnimationTime(now);
if (updated & static_cast<UpdateType>(Update::DefaultTransitionDuration)) {
style->setDefaultTransitionDuration(data.getDefaultTransitionDuration());
}
data.setAnimationTime(Clock::now());
if (updated & static_cast<UpdateType>(Update::Classes)) {
style->cascade(data.getClasses(), now);
style->cascade();
}
if (updated & static_cast<UpdateType>(Update::Classes) ||
updated & static_cast<UpdateType>(Update::Zoom)) {
style->recalculate(transformState.getNormalizedZoom(), now);
style->recalculate(transformState.getNormalizedZoom());
}
style->update(transformState, *texturePool);
@@ -330,7 +324,7 @@ MapContext::RenderResult MapContext::renderSync(const TransformState& state, con
glObjectStore.performCleanup();
if (!painter) {
painter = std::make_unique<Painter>(data.pixelRatio);
painter = std::make_unique<Painter>(data);
painter->setup();
}