fix(gui): correct calculation of vertical separator's position

This commit is contained in:
2026-01-28 03:31:54 +03:00
parent 5ea9b3b0ba
commit 49e01f0318
2 changed files with 7 additions and 4 deletions
+5 -2
View File
@@ -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() {
+2 -2
View File
@@ -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,