Skip to content

Commit

Permalink
Clarify padding order in the Java API (#2990)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie authored Nov 8, 2024
1 parent cad43fe commit ed353f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ public CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds latLngBound
* Get a camera position that fits a provided bounds and padding and the current camera tilt and bearing.
*
* @param latLngBounds the bounds to set the map with
* @param padding the padding to apply to the bounds
* @param padding the padding to apply to the bounds (in left, top, right, bottom order)
* @return the camera position that fits the bounds and padding
*/
@Nullable
Expand Down Expand Up @@ -1579,7 +1579,7 @@ public CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds latLngBound
* Get a camera position that fits a provided bounds, padding, bearing and tilt.
*
* @param latLngBounds the bounds to set the map with
* @param padding the padding to apply to the bounds
* @param padding the padding to apply to the bounds (in left, top, right, bottom order)
* @param bearing the bearing to transform the camera position with
* @param tilt to transform the camera position with
* @return the camera position that fits the bounds, bearing and tilt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void easeTo(@NonNull LatLng center, double zoom, double bearing, double pitch, d
@NonNull
CameraPosition getCameraPosition();

// Note for implementors: the ordering of the padding is left, top, right, bottom
CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds bounds, int[] padding, double bearing, double pitch);

CameraPosition getCameraForGeometry(@NonNull Geometry geometry, int[] padding, double bearing, double pitch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ public CameraPosition getCameraForLatLngBounds(
if (checkState("getCameraForLatLngBounds")) {
return null;
}
// Note that we have to juggle things a bit to match the ordering of arguments
// to match the NativeMapView C++ interface.
return nativeGetCameraForLatLngBounds(
bounds,
padding[1] / pixelRatio,
Expand Down

0 comments on commit ed353f2

Please sign in to comment.