[core] Add min and max pitch options

This commit is contained in:
Juha Alanen
2020-02-18 17:28:29 +02:00
parent f105100943
commit fdf6bb3e34
6 changed files with 95 additions and 5 deletions

View File

@@ -306,6 +306,22 @@ void Map::setBounds(const BoundOptions& options) {
}
}
if (options.maxPitch) {
impl->transform.setMaxPitch(*options.maxPitch);
if (impl->transform.getPitch() > impl->transform.getState().getMaxPitch()) {
changeCamera = true;
cameraOptions.withPitch(*options.maxPitch);
}
}
if (options.minPitch) {
impl->transform.setMinPitch(*options.minPitch);
if (impl->transform.getPitch() < impl->transform.getState().getMinPitch()) {
changeCamera = true;
cameraOptions.withPitch(*options.minPitch);
}
}
if (changeCamera) {
jumpTo(cameraOptions);
}
@@ -315,7 +331,9 @@ BoundOptions Map::getBounds() const {
return BoundOptions()
.withLatLngBounds(impl->transform.getState().getLatLngBounds())
.withMinZoom(impl->transform.getState().getMinZoom())
.withMaxZoom(impl->transform.getState().getMaxZoom());
.withMaxZoom(impl->transform.getState().getMaxZoom())
.withMinPitch(impl->transform.getState().getMinPitch())
.withMaxPitch(impl->transform.getState().getMaxPitch());
}
#pragma mark - Map options