From c921c3346c37f56ecc1d10db9ad91f8de07c8e1c Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 14 Jul 2015 18:47:46 +0300 Subject: [PATCH] Export default transition delay in Map public API Added a setter/getter for default transition delay, in the same fashion as the default transition duration. Spin-off from #1888. Fixes #302. --- include/mbgl/map/map.hpp | 4 ++++ include/mbgl/map/update.hpp | 2 +- src/mbgl/map/map.cpp | 11 ++++++++++- src/mbgl/map/map_context.cpp | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index d31d6a2757a..199bcdb0515 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -81,6 +81,10 @@ class Map : private util::noncopyable { void setDefaultTransitionDuration(const Duration& = Duration::zero()); Duration getDefaultTransitionDuration() const; + + void setDefaultTransitionDelay(const Duration& = Duration::zero()); + Duration getDefaultTransitionDelay() const; + void setStyleURL(const std::string& url); void setStyleJSON(const std::string& json, const std::string& base = ""); std::string getStyleURL() const; diff --git a/include/mbgl/map/update.hpp b/include/mbgl/map/update.hpp index 40cc1bc2bc8..d2d6133bc2c 100644 --- a/include/mbgl/map/update.hpp +++ b/include/mbgl/map/update.hpp @@ -10,7 +10,7 @@ using UpdateType = uint32_t; enum class Update : UpdateType { Nothing = 0, Dimensions = 1 << 1, - DefaultTransitionDuration = 1 << 2, + DefaultTransition = 1 << 2, Classes = 1 << 3, Zoom = 1 << 4, RenderStill = 1 << 5, diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 0e58a2912db..18de3154793 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -418,13 +418,22 @@ std::vector Map::getClasses() const { void Map::setDefaultTransitionDuration(const Duration& duration) { data->setDefaultTransitionDuration(duration); - update(Update::DefaultTransitionDuration); + update(Update::DefaultTransition); } Duration Map::getDefaultTransitionDuration() const { return data->getDefaultTransitionDuration(); } +void Map::setDefaultTransitionDelay(const Duration& delay) { + data->setDefaultTransitionDelay(delay); + update(Update::DefaultTransition); +} + +Duration Map::getDefaultTransitionDelay() const { + return data->getDefaultTransitionDelay(); +} + void Map::setSourceTileCacheSize(size_t size) { context->invoke(&MapContext::setSourceTileCacheSize, size); } diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index 61614dd0e4c..56ee7ac7caa 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -136,7 +136,7 @@ void MapContext::loadStyleJSON(const std::string& json, const std::string& base) // force style cascade, causing all pending transitions to complete. style->cascade(); - updated |= static_cast(Update::DefaultTransitionDuration); + updated |= static_cast(Update::DefaultTransition); updated |= static_cast(Update::Classes); updated |= static_cast(Update::Zoom); asyncUpdate->send();