foundations of delegate/callback API

This commit is contained in:
Justin R. Miller
2014-05-23 18:32:55 -07:00
parent 2d7b76e2fe
commit 661860d12f
4 changed files with 15 additions and 1 deletions

View File

@@ -273,5 +273,9 @@ void show_color_debug_image(std::string name, const char *data, size_t logical_w
glfwMakeContextCurrent(current_window);
}
void notify_map_change() {
// no-op
}
}
}

View File

@@ -32,6 +32,9 @@ std::shared_ptr<Request> request_http(const std::string &url,
// Cancels an HTTP request.
void cancel_request_http(const std::shared_ptr<Request> &req);
// Notifies a watcher of map x/y/scale/rotation changes.
void notify_map_change();
// Shows an alpha image with the specified dimensions in a named window.
void show_debug_image(std::string name, const char *data, size_t width, size_t height);

View File

@@ -35,6 +35,7 @@ bool Transform::resize(const uint16_t w, const uint16_t h, const float ratio,
current.framebuffer[1] = final.framebuffer[1] = fb_h;
if (!canRotate()) _setAngle(0);
constrain(current.scale, current.y);
platform::notify_map_change();
return true;
} else {
return false;
@@ -74,6 +75,8 @@ void Transform::_moveBy(const double dx, const double dy, const time duration) {
transitions.emplace_front(
std::make_shared<util::ease_transition<double>>(current.y, final.y, current.y, start, duration));
}
platform::notify_map_change();
}
void Transform::setLonLat(const double lon, const double lat, const time duration) {
@@ -290,6 +293,8 @@ void Transform::_setScaleXY(const double new_scale, const double xn, const doubl
zc = s / 2;
Bc = s / 360;
Cc = s / (2 * M_PI);
platform::notify_map_change();
}
#pragma mark - Constraints
@@ -390,6 +395,8 @@ void Transform::_setAngle(double new_angle, const time duration, bool disable_in
transitions.emplace_front(interaction_timeout);
}
}
platform::notify_map_change();
}
double Transform::getAngle() const {