Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] - apply tilt to markerview with initial camera position (#6622
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tobrun authored Oct 7, 2016
1 parent 3b8b68d commit 740c995
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,20 @@ public void onMapChanged(@MapChange int change) {
reloadIcons();
reloadMarkers();
adjustTopOffsetPixels();

// Notify listeners the map is ready
if (onMapReadyCallbackList.size() > 0) {
Iterator<OnMapReadyCallback> iterator = onMapReadyCallbackList.iterator();
while (iterator.hasNext()) {
OnMapReadyCallback callback = iterator.next();
callback.onMapReady(mapboxMap);
iterator.remove();
}
mapboxMap.getMarkerViewManager().scheduleViewMarkerInvalidation();
}

// invalidate camera to update overlain views with correct tilt value
invalidateCameraPosition();

} else if (change == REGION_IS_CHANGING || change == REGION_DID_CHANGE || change == DID_FINISH_LOADING_MAP) {
mapboxMap.getMarkerViewManager().scheduleViewMarkerInvalidation();

Expand Down Expand Up @@ -658,6 +663,7 @@ LatLng getLatLng() {
}

void setTilt(Double pitch) {
mapboxMap.getMarkerViewManager().setTilt(pitch.floatValue());
myLocationView.setTilt(pitch);
nativeMapView.setPitch(pitch, 0);
}
Expand Down Expand Up @@ -1533,6 +1539,7 @@ CameraPosition invalidateCameraPosition() {
}
CameraPosition position = new CameraPosition.Builder(nativeMapView.getCameraValues()).build();
myLocationView.setCameraPosition(position);
mapboxMap.getMarkerViewManager().setTilt((float) Math.toDegrees(position.tilt));
return position;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,6 @@ public String getAccessToken() {
//

void setTilt(double tilt) {
markerViewManager.setTilt((float) tilt);
mapView.setTilt(tilt);
}

Expand Down

0 comments on commit 740c995

Please sign in to comment.