From 74538406e9e7f9444e491ea23b7dc52f63d77e73 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Fri, 1 Mar 2019 10:14:07 +0200 Subject: [core] Organize Map::{move,pitch,scale,rotate}By --- src/mbgl/map/map.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/mbgl') diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index e2b56b8d55..7fe99e3867 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -159,21 +159,27 @@ void Map::flyTo(const CameraOptions& camera, const AnimationOptions& animation) impl->onUpdate(); } -#pragma mark - Position - void Map::moveBy(const ScreenCoordinate& point, const AnimationOptions& animation) { impl->cameraMutated = true; impl->transform.moveBy(point, animation); impl->onUpdate(); } -#pragma mark - Zoom +void Map::pitchBy(double pitch, const AnimationOptions& animation) { + easeTo(CameraOptions().withPitch((impl->transform.getPitch() * util::RAD2DEG) - pitch), animation); +} void Map::scaleBy(double scale, optional anchor, const AnimationOptions& animation) { const double zoom = impl->transform.getZoom() + impl->transform.getState().scaleZoom(scale); easeTo(CameraOptions().withZoom(zoom).withAnchor(anchor), animation); } +void Map::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& animation) { + impl->cameraMutated = true; + impl->transform.rotateBy(first, second, animation); + impl->onUpdate(); +} + CameraOptions Map::cameraForLatLngBounds(const LatLngBounds& bounds, const EdgeInsets& padding, optional bearing, optional pitch) const { return cameraForLatLngs({ bounds.northwest(), @@ -270,12 +276,6 @@ LatLngBounds Map::latLngBoundsForCamera(const CameraOptions& camera) const { ); } -#pragma mark - Pitch - -void Map::pitchBy(double pitch, const AnimationOptions& animation) { - easeTo(CameraOptions().withPitch((impl->transform.getPitch() * util::RAD2DEG) - pitch), animation); -} - #pragma mark - Bounds optional Map::getLatLngBounds() const { @@ -343,14 +343,6 @@ Size Map::getSize() const { return impl->transform.getState().getSize(); } -#pragma mark - Rotation - -void Map::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& animation) { - impl->cameraMutated = true; - impl->transform.rotateBy(first, second, animation); - impl->onUpdate(); -} - #pragma mark - North Orientation void Map::setNorthOrientation(NorthOrientation orientation) { -- cgit v1.2.1