mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
fix(gui): correct calculation of vertical separator's position
This commit is contained in:
+5
-2
@@ -260,7 +260,9 @@ impl SoundpadGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn draw_body(&mut self, ui: &mut Ui) {
|
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)
|
.max(100.0)
|
||||||
.min(ui.available_width() - 100.0);
|
.min(ui.available_width() - 100.0);
|
||||||
let dirs_size = Vec2::new(left_panel_width, ui.available_height() - 40.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);
|
response.on_hover_and_drag_cursor(CursorIcon::ResizeHorizontal);
|
||||||
|
|
||||||
if vertical_separator_response.dragged() {
|
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() {
|
if vertical_separator_response.drag_stopped() {
|
||||||
|
|||||||
+2
-2
@@ -34,7 +34,7 @@ impl DaemonConfig {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GuiConfig {
|
pub struct GuiConfig {
|
||||||
pub scale_factor: f32,
|
pub scale_factor: f32,
|
||||||
pub vertical_separator_width: f32,
|
pub left_panel_width: f32,
|
||||||
|
|
||||||
pub save_volume: bool,
|
pub save_volume: bool,
|
||||||
pub save_input: bool,
|
pub save_input: bool,
|
||||||
@@ -48,7 +48,7 @@ impl Default for GuiConfig {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
GuiConfig {
|
GuiConfig {
|
||||||
scale_factor: 1.0,
|
scale_factor: 1.0,
|
||||||
vertical_separator_width: 0.0,
|
left_panel_width: 280.0,
|
||||||
|
|
||||||
save_volume: false,
|
save_volume: false,
|
||||||
save_input: false,
|
save_input: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user