diff options
Diffstat (limited to 'platform/ios/MGLMapView.mm')
-rw-r--r-- | platform/ios/MGLMapView.mm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 5fcd045b74..29377bf2c8 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -892,7 +892,14 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration) CGPoint delta = CGPointMake([pan translationInView:pan.view].x - self.centerPoint.x, [pan translationInView:pan.view].y - self.centerPoint.y); - _mbglMap->moveBy(delta.x, delta.y); + double flippedY = self.bounds.size.height - [pan locationInView:pan.view].y; + _mbglMap->setLatLng( + _mbglMap->latLngForPixel(mbgl::vec2<double>( + [pan locationInView:pan.view].x - delta.x, + flippedY + delta.y)), + mbgl::vec2<double>( + [pan locationInView:pan.view].x, + flippedY)); self.centerPoint = CGPointMake(self.centerPoint.x + delta.x, self.centerPoint.y + delta.y); @@ -1063,7 +1070,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration) _mbglMap->setBearing(newDegrees, [rotate locationInView:rotate.view].x, - [rotate locationInView:rotate.view].y); + self.bounds.size.height - [rotate locationInView:rotate.view].y); } else if (rotate.state == UIGestureRecognizerStateEnded || rotate.state == UIGestureRecognizerStateCancelled) { |