From b9b79031089a3079be0ebe6a721b05dca0c5dead Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 28 Mar 2022 00:51:58 +0200 Subject: [PATCH] Add a lower limit to the GUI size scaling --- nih_plug_vizia/src/widgets/resize_handle.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nih_plug_vizia/src/widgets/resize_handle.rs b/nih_plug_vizia/src/widgets/resize_handle.rs index 629b3150..60ef6202 100644 --- a/nih_plug_vizia/src/widgets/resize_handle.rs +++ b/nih_plug_vizia/src/widgets/resize_handle.rs @@ -76,10 +76,12 @@ impl View for ResizeHandle { y * self.start_scale_factor as f32, ); let (start_physical_x, start_physical_y) = self.start_physical_coordinates; - let new_scale_factor = self.start_scale_factor + let new_scale_factor = (self.start_scale_factor * (compensated_physical_x / start_physical_x) .max(compensated_physical_y / start_physical_y) - as f64; + as f64) + // Prevent approaching zero here because uh + .max(0.25); if new_scale_factor != vizia_state.user_scale_factor() { cx.emit(WindowEvent::SetScale(new_scale_factor)); }