Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Export default transition delay in Map public API
Browse files Browse the repository at this point in the history
Added a setter/getter for default transition delay, in the same fashion
as the default transition duration.

Spin-off from #1888. Fixes #302.
  • Loading branch information
brunoabinader committed Jul 14, 2015
1 parent bef3e15 commit c921c33
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions include/mbgl/map/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/map/update.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 10 additions & 1 deletion src/mbgl/map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,22 @@ std::vector<std::string> 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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/map/map_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<UpdateType>(Update::DefaultTransitionDuration);
updated |= static_cast<UpdateType>(Update::DefaultTransition);
updated |= static_cast<UpdateType>(Update::Classes);
updated |= static_cast<UpdateType>(Update::Zoom);
asyncUpdate->send();
Expand Down

0 comments on commit c921c33

Please sign in to comment.