Skip to content

Commit

Permalink
Directly call MapController methods for setting position, tilt withou…
Browse files Browse the repository at this point in the history
…t animation (#156)
  • Loading branch information
sarahsnow1 authored and ecgreb committed Aug 5, 2016
1 parent 1e2ee21 commit 7a958b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions library/src/main/java/com/mapzen/android/graphics/MapzenMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 7a958b4

Please sign in to comment.