From 7a958b4be4835000aa00dcd4c73e018a49628a2b Mon Sep 17 00:00:00 2001 From: Sarah Lensing Date: Fri, 5 Aug 2016 13:46:44 -0600 Subject: [PATCH] Directly call MapController methods for setting position, tilt without animation (#156) --- .../java/com/mapzen/android/graphics/MapzenMap.java | 12 ++++++++---- .../com/mapzen/android/graphics/MapzenMapTest.java | 8 ++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/library/src/main/java/com/mapzen/android/graphics/MapzenMap.java b/library/src/main/java/com/mapzen/android/graphics/MapzenMap.java index 2fb88645..3e9f6c3b 100644 --- a/library/src/main/java/com/mapzen/android/graphics/MapzenMap.java +++ b/library/src/main/java/com/mapzen/android/graphics/MapzenMap.java @@ -148,7 +148,8 @@ public void setStyle(MapStyle mapStyle) { * Sets map zoom without animation. */ public void setZoom(float zoom) { - setZoom(zoom, 0); + mapStateManager.setZoom(zoom); + mapController.setZoom(zoom); } /** @@ -184,7 +185,8 @@ public float getZoom() { * Set map position without animation. */ public void setPosition(LngLat lngLat) { - setPosition(lngLat, 0); + mapStateManager.setPosition(lngLat); + mapController.setPosition(lngLat); } /** @@ -221,7 +223,8 @@ public LngLat getPosition() { * Set map rotation in radians without animation. */ public void setRotation(float radians) { - setRotation(radians, 0); + mapStateManager.setRotation(radians); + mapController.setRotation(radians); } /** @@ -260,7 +263,8 @@ public float getRotation() { * @param radians tilt in radians */ public void setTilt(float radians) { - setTilt(radians, 0); + mapStateManager.setTilt(radians); + mapController.setTilt(radians); } /** diff --git a/library/src/test/java/com/mapzen/android/graphics/MapzenMapTest.java b/library/src/test/java/com/mapzen/android/graphics/MapzenMapTest.java index dc0d3045..314cc28d 100644 --- a/library/src/test/java/com/mapzen/android/graphics/MapzenMapTest.java +++ b/library/src/test/java/com/mapzen/android/graphics/MapzenMapTest.java @@ -57,7 +57,7 @@ public class MapzenMapTest { @Test public void setZoom_shouldInvokeMapController() throws Exception { map.setZoom(15); - verify(mapController).setZoomEased(15, 0, MapController.EaseType.CUBIC); + verify(mapController).setZoom(15); } @Test public void setZoomAnimated_shouldInvokeMapControllerAnimated() throws Exception { @@ -79,7 +79,7 @@ public class MapzenMapTest { @Test public void setPosition_shouldInvokeMapController() throws Exception { LngLat lngLat = new LngLat(70, 40); map.setPosition(lngLat); - verify(mapController).setPositionEased(lngLat, 0, MapController.EaseType.CUBIC); + verify(mapController).setPosition(lngLat); } @Test public void setPositionAnimated_shouldInvokeMapControllerAnimated() throws Exception { @@ -103,7 +103,7 @@ public class MapzenMapTest { @Test public void setRotation_shouldInvokeMapController() throws Exception { map.setRotation(3.14f); - verify(mapController).setRotationEased(3.14f, 0, MapController.EaseType.CUBIC); + verify(mapController).setRotation(3.14f); } @Test public void setRotationAnimated_shouldInvokeMapControllerAnimated() throws Exception { @@ -124,7 +124,7 @@ public class MapzenMapTest { @Test public void setTilt_shouldInvokeMapController() throws Exception { map.setTilt(3.14f); - verify(mapController).setTiltEased(3.14f, 0, MapController.EaseType.CUBIC); + verify(mapController).setTilt(3.14f); } @Test public void setTiltAnimated_shouldInvokeMapControllerAnimated() throws Exception {