Skip to content

Commit 1b02899

Browse files
committed
Remove hard coded lower zoom limit
1 parent 7d18095 commit 1b02899

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/lib.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,14 @@ pub struct PanOrbitCamera {
172172
/// Defaults to `None`.
173173
pub pitch_lower_limit: Option<f32>,
174174
/// Upper limit on the zoom. This applies to `radius`, in the case of using a perspective
175-
/// camera, or the projection scale in the case of using an orthographic
176-
/// camera. Note that the zoom value (radius or scale) will never go below `0.02`.
175+
/// camera, or the projection's scale in the case of using an orthographic camera.
177176
/// Defaults to `None`.
178177
pub zoom_upper_limit: Option<f32>,
179178
/// Lower limit on the zoom. This applies to `radius`, in the case of using a perspective
180-
/// camera, or the projection scale in the case of using an orthographic
181-
/// camera. Note that the zoom value (radius or scale) will never go below `0.02`.
182-
/// Defaults to `None`.
183-
pub zoom_lower_limit: Option<f32>,
179+
/// camera, or the projection's scale in the case of using an orthographic camera.
180+
/// Should always be >0 otherwise you'll get stuck at 0.
181+
/// Defaults to `0.05`.
182+
pub zoom_lower_limit: f32,
184183
/// The sensitivity of the orbiting motion.
185184
/// Defaults to `1.0`.
186185
pub orbit_sensitivity: f32,
@@ -283,7 +282,7 @@ impl Default for PanOrbitCamera {
283282
pitch_upper_limit: None,
284283
pitch_lower_limit: None,
285284
zoom_upper_limit: None,
286-
zoom_lower_limit: None,
285+
zoom_lower_limit: 0.05,
287286
force_update: false,
288287
}
289288
}
@@ -413,10 +412,7 @@ fn pan_orbit_camera(
413412
let apply_zoom_limits = {
414413
let zoom_upper_limit = pan_orbit.zoom_upper_limit;
415414
let zoom_lower_limit = pan_orbit.zoom_lower_limit;
416-
move |zoom: f32| {
417-
zoom.clamp_optional(zoom_lower_limit, zoom_upper_limit)
418-
.max(0.05)
419-
}
415+
move |zoom: f32| zoom.clamp_optional(Some(zoom_lower_limit), zoom_upper_limit)
420416
};
421417

422418
let apply_yaw_limits = {

0 commit comments

Comments
 (0)