fix: good width and spacing for sliders in gupaxx tab
Some checks failed
Lockbud / lockbud (push) Waiting to run
Rust / fmt (push) Waiting to run
Rust / test (push) Waiting to run
Rust / clippy (macos-latest) (push) Waiting to run
Rust / clippy (ubuntu-latest) (push) Waiting to run
Rust / check (macos-latest) (push) Waiting to run
Rust / check (ubuntu-latest) (push) Waiting to run
Rust / doc (push) Waiting to run
Typo / typo (push) Waiting to run
Audit / audit (push) Has been cancelled

This commit is contained in:
Cyrix126 2024-12-12 00:51:52 +01:00
parent f5b765c55f
commit 16281c8479

View file

@ -6,6 +6,7 @@ use crate::components::update::Update;
use crate::components::update::check_binary_path; use crate::components::update::check_binary_path;
use crate::disk::state::*; use crate::disk::state::*;
use crate::miscs::height_txt_before_button; use crate::miscs::height_txt_before_button;
use common::state_edit_field::slider_state_field;
use log::debug; use log::debug;
use std::path::Path; use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
@ -205,6 +206,7 @@ impl Gupax {
ui.horizontal(|ui| { ui.horizontal(|ui| {
ScrollArea::horizontal().show(ui, |ui| { ScrollArea::horizontal().show(ui, |ui| {
ui.vertical(|ui| { ui.vertical(|ui| {
ui.set_max_width(ui.available_width() / 2.0);
match self.ratio { match self.ratio {
Ratio::None => (), Ratio::None => (),
Ratio::Width => { Ratio::Width => {
@ -220,34 +222,45 @@ impl Gupax {
} }
// let height = height / 3.5; // let height = height / 3.5;
// let size = vec2(width, height); // let size = vec2(width, height);
ui.horizontal(|ui| {
ui.add_enabled_ui(self.ratio != Ratio::Height, |ui| { ui.add_enabled_ui(self.ratio != Ratio::Height, |ui| {
ui.label(format!( let description = format!(
" Width [{}-{}]:", " Width [{}-{}]:",
APP_MIN_WIDTH as u16, APP_MAX_WIDTH as u16 APP_MIN_WIDTH as u16, APP_MAX_WIDTH as u16
)); );
ui.add(Slider::new( slider_state_field(
ui,
&description,
GUPAX_WIDTH,
&mut self.selected_width, &mut self.selected_width,
APP_MIN_WIDTH as u16..=APP_MAX_WIDTH as u16, APP_MIN_WIDTH as u16..=APP_MAX_WIDTH as u16,
)) );
.on_hover_text(GUPAX_WIDTH);
}); });
});
ui.horizontal(|ui| {
ui.add_enabled_ui(self.ratio != Ratio::Width, |ui| { ui.add_enabled_ui(self.ratio != Ratio::Width, |ui| {
ui.label(format!( let description = format!(
" Height [{}-{}]:", " Height [{}-{}]:",
APP_MIN_HEIGHT as u16, APP_MAX_HEIGHT as u16 APP_MIN_HEIGHT as u16, APP_MAX_HEIGHT as u16
)); );
ui.add(Slider::new( slider_state_field(
ui,
&description,
GUPAX_HEIGHT,
&mut self.selected_height, &mut self.selected_height,
APP_MIN_HEIGHT as u16..=APP_MAX_HEIGHT as u16, APP_MIN_HEIGHT as u16..=APP_MAX_HEIGHT as u16,
)) );
.on_hover_text(GUPAX_HEIGHT);
});
}); });
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.label(format!(" Scaling [{APP_MIN_SCALE}..{APP_MAX_SCALE}]:")); let description =
format!(" Scaling [{APP_MIN_SCALE}..{APP_MAX_SCALE}]:");
ui.add_sized(
[0.0, height_txt_before_button(ui, &TextStyle::Body)],
Label::new(description),
);
ui.style_mut().spacing.slider_width = (ui.available_width()
- ui.spacing().item_spacing.x * 4.0
- ui.spacing().scroll.bar_width
- SPACE * 1.0
+ 2.0)
.max(80.0);
ui.add( ui.add(
Slider::new( Slider::new(
&mut self.selected_scale, &mut self.selected_scale,