Fix zoom towards target point
@@ -66,8 +66,8 @@ impl CameraControl {
&mut self,
point: &Vec3,
delta: f32,
- min: f32,
- max: f32,
+ minimum: f32,
+ maximum: f32,
) -> Result<(), Error> {
let distance = point.distance(*self.position());
match self.projection_type() {
@@ -76,7 +76,7 @@ impl CameraControl {
height,
depth,
} => {
- let h = (height - delta * distance).max(min).min(max);
+ let h = (height - delta * distance).max(minimum).min(maximum);
let w = h * width / height;
let d = *depth;
self.set_orthographic_projection(w, h, d)?;
@@ -86,8 +86,8 @@ impl CameraControl {
let up = *self.up();
let direction = self.view_direction();
let mut zoom = (delta + 1.0) * distance;
- zoom = zoom.max(min).min(max);
- self.set_view(target - direction * zoom, target, up)?;
+ zoom = zoom.max(minimum).min(maximum);
+ self.set_view(point - direction * zoom, target, up)?;
}
}
Ok(())
