From e5d9a20c7c3282a7b058ef40c2ade3429f04f99d Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Thu, 3 Jul 2014 19:02:46 -0700 Subject: native-side map change notifications --- src/map/transform.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/map/transform.cpp b/src/map/transform.cpp index c7bbbfdf7d..72449956d0 100644 --- a/src/map/transform.cpp +++ b/src/map/transform.cpp @@ -28,6 +28,8 @@ bool Transform::resize(const uint16_t w, const uint16_t h, const float ratio, if (final.width != w || final.height != h || final.pixelRatio != ratio || final.framebuffer[0] != fb_w || final.framebuffer[1] != fb_h) { + platform::notify_map_change(platform::MapChangeRegionWillChange); + current.width = final.width = w; current.height = final.height = h; current.pixelRatio = final.pixelRatio = ratio; @@ -35,7 +37,9 @@ bool Transform::resize(const uint16_t w, const uint16_t h, const float ratio, current.framebuffer[1] = final.framebuffer[1] = fb_h; if (!canRotate() && current.angle) _setAngle(0); constrain(current.scale, current.y); - platform::notify_map_change(); + + platform::notify_map_change(platform::MapChangeRegionDidChange); + return true; } else { return false; @@ -76,7 +80,9 @@ void Transform::_moveBy(const double dx, const double dy, const timestamp durati std::make_shared>(current.y, final.y, current.y, start, duration)); } - platform::notify_map_change(); + platform::notify_map_change(duration ? + platform::MapChangeRegionDidChangeAnimated : + platform::MapChangeRegionDidChange); } void Transform::setLonLat(const double lon, const double lat, const timestamp duration) { @@ -294,7 +300,9 @@ void Transform::_setScaleXY(const double new_scale, const double xn, const doubl Bc = s / 360; Cc = s / (2 * M_PI); - platform::notify_map_change(); + platform::notify_map_change(duration ? + platform::MapChangeRegionDidChangeAnimated : + platform::MapChangeRegionDidChange); } #pragma mark - Constraints @@ -388,7 +396,9 @@ void Transform::_setAngle(double new_angle, const timestamp duration) { current.angle, final.angle, current.angle, start, duration)); } - platform::notify_map_change(); + platform::notify_map_change(duration ? + platform::MapChangeRegionDidChangeAnimated : + platform::MapChangeRegionDidChange); } double Transform::getAngle() const { -- cgit v1.2.1