[glfw] add map change callback methods to glfw_view

This commit is contained in:
Ivo van Dongen
2016-10-19 16:05:36 +03:00
committed by Bruno de Oliveira Abinader
parent 04a9a98b98
commit ab85fdb452
2 changed files with 15 additions and 0 deletions

View File

@@ -42,6 +42,9 @@ public:
void run();
void report(float duration);
void setMapChangeCallback(std::function<void(mbgl::MapChange)> callback);
void notifyMapChange(mbgl::MapChange change) override;
private:
mbgl::Color makeRandomColor() const;
@@ -62,6 +65,8 @@ private:
mbgl::AnnotationIDs annotationIDs;
std::vector<std::string> spriteIDs;
std::function<void(mbgl::MapChange)> mapChangeCallback;
private:
bool fullscreen = false;
const bool benchmark = false;

View File

@@ -508,6 +508,16 @@ void GLFWView::setWindowTitle(const std::string& title) {
glfwSetWindowTitle(window, (std::string { "Mapbox GL: " } + title).c_str());
}
void GLFWView::setMapChangeCallback(std::function<void(mbgl::MapChange)> callback) {
this->mapChangeCallback = callback;
}
void GLFWView::notifyMapChange(mbgl::MapChange change) {
if (mapChangeCallback) {
mapChangeCallback(change);
}
}
namespace mbgl {
namespace platform {