bevy_lagrange 0.0.3

Bevy camera controller with pan, orbit, zoom-to-fit, queued animations, and trackpad support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Clamps a value between two optional bounds. If both `min` and `max` are `None`,
/// returns the value unchanged.
pub(crate) const fn clamp_optional(value: f32, min: Option<f32>, max: Option<f32>) -> f32 {
    let mut v = value;
    if let Some(min) = min
        && v < min
    {
        v = min;
    }
    if let Some(max) = max
        && v > max
    {
        v = max;
    }
    v
}