From 49e01f03182ae7f84ffe47b3633dc02fd599cafa Mon Sep 17 00:00:00 2001 From: arabian Date: Wed, 28 Jan 2026 03:31:54 +0300 Subject: [PATCH] fix(gui): correct calculation of vertical separator's position --- src/gui/draw.rs | 7 +++++-- src/types/config.rs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/draw.rs b/src/gui/draw.rs index 26e8dba..e3dac7e 100644 --- a/src/gui/draw.rs +++ b/src/gui/draw.rs @@ -260,7 +260,9 @@ impl SoundpadGui { } fn draw_body(&mut self, ui: &mut Ui) { - let left_panel_width = (ui.available_width() / 4.0 + self.config.vertical_separator_width) + let left_panel_width = self + .config + .left_panel_width .max(100.0) .min(ui.available_width() - 100.0); let dirs_size = Vec2::new(left_panel_width, ui.available_height() - 40.0); @@ -282,7 +284,8 @@ impl SoundpadGui { response.on_hover_and_drag_cursor(CursorIcon::ResizeHorizontal); if vertical_separator_response.dragged() { - self.config.vertical_separator_width += vertical_separator_response.drag_delta().x; + self.config.left_panel_width += vertical_separator_response.drag_delta().x; + self.config.left_panel_width = self.config.left_panel_width.clamp(100.0, 500.0); } if vertical_separator_response.drag_stopped() { diff --git a/src/types/config.rs b/src/types/config.rs index f40affb..44f566a 100644 --- a/src/types/config.rs +++ b/src/types/config.rs @@ -34,7 +34,7 @@ impl DaemonConfig { #[serde(default)] pub struct GuiConfig { pub scale_factor: f32, - pub vertical_separator_width: f32, + pub left_panel_width: f32, pub save_volume: bool, pub save_input: bool, @@ -48,7 +48,7 @@ impl Default for GuiConfig { fn default() -> Self { GuiConfig { scale_factor: 1.0, - vertical_separator_width: 0.0, + left_panel_width: 280.0, save_volume: false, save_input: false,