native-side map change notifications
This commit is contained in:
@@ -48,8 +48,8 @@ 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();
|
||||
// Notifies a watcher of map changes.
|
||||
void notify_map_change(MapChange key);
|
||||
|
||||
// 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);
|
||||
|
||||
Submodule ios/mapbox-gl-cocoa updated: f9dec39f77...0d472e64d6
@@ -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<util::ease_transition<double>>(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 {
|
||||
|
||||
Reference in New Issue
Block a user