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

@@ -3,6 +3,7 @@
#include <mbgl/map/source.hpp>
#include <mbgl/map/tile.hpp>
#include <mbgl/map/map_context.hpp>
#include <mbgl/map/map_data.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/gl/debugging.hpp>
@@ -41,14 +42,14 @@
using namespace mbgl;
Painter::Painter(const float pixelRatio_) : pixelRatio(pixelRatio_) {
Painter::Painter(MapData& data_) : data(data_) {
}
Painter::~Painter() {
}
bool Painter::needsAnimation() const {
return frameHistory.needsAnimation(std::chrono::milliseconds(300));
return frameHistory.needsAnimation(data.getDefaultFadeDuration()) || state.isChanging();
}
void Painter::setup() {