[core] Factor timePoint initialization: take 2
This commit is contained in:
@@ -207,7 +207,9 @@ void Map::render(View& view) {
|
||||
}
|
||||
|
||||
void Map::Impl::render(View& view) {
|
||||
TimePoint timePoint = Clock::now();
|
||||
TimePoint timePoint = mode == MapMode::Continuous
|
||||
? Clock::now()
|
||||
: Clock::time_point::max();
|
||||
|
||||
transform.updateTransitions(timePoint);
|
||||
|
||||
|
||||
@@ -13,19 +13,20 @@ struct ZoomHistory {
|
||||
bool first = true;
|
||||
|
||||
bool update(float z, const TimePoint& now) {
|
||||
constexpr TimePoint zero = TimePoint(Duration::zero());
|
||||
if (first) {
|
||||
first = false;
|
||||
lastIntegerZoom = std::floor(z);
|
||||
lastIntegerZoomTime = TimePoint(Duration::zero());
|
||||
lastIntegerZoomTime = zero;
|
||||
lastZoom = z;
|
||||
return true;
|
||||
} else {
|
||||
if (std::floor(lastZoom) < std::floor(z)) {
|
||||
lastIntegerZoom = std::floor(z);
|
||||
lastIntegerZoomTime = now;
|
||||
lastIntegerZoomTime = now == Clock::time_point::max() ? zero : now;
|
||||
} else if (std::floor(lastZoom) > std::floor(z)) {
|
||||
lastIntegerZoom = std::floor(z + 1);
|
||||
lastIntegerZoomTime = now;
|
||||
lastIntegerZoomTime = now == Clock::time_point::max() ? zero : now;
|
||||
}
|
||||
|
||||
if (z != lastZoom) {
|
||||
|
||||
@@ -86,13 +86,13 @@ void RenderStyle::update(const UpdateParameters& parameters) {
|
||||
const bool zoomChanged = zoomHistory.update(parameters.transformState.getZoom(), parameters.timePoint);
|
||||
|
||||
const TransitionParameters transitionParameters {
|
||||
parameters.mode == MapMode::Continuous ? parameters.timePoint : Clock::time_point::max(),
|
||||
parameters.timePoint,
|
||||
parameters.mode == MapMode::Continuous ? parameters.transitionOptions : TransitionOptions()
|
||||
};
|
||||
|
||||
const PropertyEvaluationParameters evaluationParameters {
|
||||
zoomHistory,
|
||||
parameters.mode == MapMode::Continuous ? parameters.timePoint : Clock::time_point::max(),
|
||||
parameters.timePoint,
|
||||
parameters.mode == MapMode::Continuous ? util::DEFAULT_TRANSITION_DURATION : Duration::zero()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user