[core] Added {set,get}{Min,Max}Pitch

This commit is contained in:
Bruno de Oliveira Abinader
2017-04-03 18:37:03 +03:00
parent c1c6c1e298
commit c4fc89977b
7 changed files with 83 additions and 2 deletions

View File

@@ -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) {