[core, ios, osx] cameraThatFitsCoordinateBounds
Added an API to get a camera that you can pass into -[MGLMapView setCamera:] that fits the given coordinate bounds, by analogy with -[MKMapView regionThatFits:] or -[MKMapView mapRectThatFits:edgePadding:]. Added mbgl::Map::getCameraOptions() for getting the current camera options more conveniently.
This commit is contained in:
committed by
Minh Nguyễn
parent
5939dd5b41
commit
466ed55200
@@ -62,6 +62,16 @@ bool Transform::resize(const std::array<uint16_t, 2> size) {
|
||||
|
||||
#pragma mark - Camera
|
||||
|
||||
CameraOptions Transform::getCameraOptions(optional<EdgeInsets> padding) const {
|
||||
CameraOptions camera;
|
||||
camera.center = getLatLng(padding);
|
||||
camera.padding = padding;
|
||||
camera.zoom = getZoom();
|
||||
camera.angle = getAngle();
|
||||
camera.pitch = getPitch();
|
||||
return camera;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change any combination of center, zoom, bearing, and pitch, without
|
||||
* a transition. The map will retain the current values for any options
|
||||
|
||||
Reference in New Issue
Block a user