summaryrefslogtreecommitdiff
path: root/src/mbgl/map/transform.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-03 18:37:03 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-11 12:51:09 +0300
commitc4fc89977bcba83ed5de87dcc8de1a68e8a31541 (patch)
treee304b26bb59523b4ee30136f9f615742eb4dbb91 /src/mbgl/map/transform.cpp
parentc1c6c1e298521c177b64665b823d1444ce5e2cfe (diff)
downloadqtlocation-mapboxgl-c4fc89977bcba83ed5de87dcc8de1a68e8a31541.tar.gz
[core] Added {set,get}{Min,Max}Pitch
Diffstat (limited to 'src/mbgl/map/transform.cpp')
-rw-r--r--src/mbgl/map/transform.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 469db09e0a..9febc3ab5a 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -120,7 +120,7 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim
// Constrain camera options.
zoom = util::clamp(zoom, state.getMinZoom(), state.getMaxZoom());
const double scale = state.zoomScale(zoom);
- pitch = util::clamp(pitch, 0., util::PITCH_MAX);
+ pitch = util::clamp(pitch, state.min_pitch, state.max_pitch);
Update update = state.getZoom() == zoom ? Update::Repaint : Update::RecalculateStyle;
@@ -188,7 +188,7 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima
// Constrain camera options.
zoom = util::clamp(zoom, state.getMinZoom(), state.getMaxZoom());
- pitch = util::clamp(pitch, 0., util::PITCH_MAX);
+ pitch = util::clamp(pitch, state.min_pitch, state.max_pitch);
// Minimize rotation by taking the shorter path around the circle.
angle = _normalizeAngle(angle, state.angle);
@@ -451,6 +451,16 @@ void Transform::setMaxZoom(const double maxZoom) {
state.setMaxZoom(maxZoom);
}
+void Transform::setMinPitch(double minPitch) {
+ if (std::isnan(minPitch)) return;
+ state.setMinPitch(minPitch);
+}
+
+void Transform::setMaxPitch(double maxPitch) {
+ if (std::isnan(maxPitch)) return;
+ state.setMaxPitch(maxPitch);
+}
+
#pragma mark - Angle
void Transform::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& animation) {