mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 06:39:21 +00:00
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
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:
parent
f5b765c55f
commit
16281c8479
1 changed files with 39 additions and 26 deletions
|
@ -6,6 +6,7 @@ use crate::components::update::Update;
|
|||
use crate::components::update::check_binary_path;
|
||||
use crate::disk::state::*;
|
||||
use crate::miscs::height_txt_before_button;
|
||||
use common::state_edit_field::slider_state_field;
|
||||
use log::debug;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
@ -205,6 +206,7 @@ impl Gupax {
|
|||
ui.horizontal(|ui| {
|
||||
ScrollArea::horizontal().show(ui, |ui| {
|
||||
ui.vertical(|ui| {
|
||||
ui.set_max_width(ui.available_width() / 2.0);
|
||||
match self.ratio {
|
||||
Ratio::None => (),
|
||||
Ratio::Width => {
|
||||
|
@ -220,34 +222,45 @@ impl Gupax {
|
|||
}
|
||||
// let height = height / 3.5;
|
||||
// let size = vec2(width, height);
|
||||
ui.horizontal(|ui| {
|
||||
ui.add_enabled_ui(self.ratio != Ratio::Height, |ui| {
|
||||
ui.label(format!(
|
||||
" Width [{}-{}]:",
|
||||
APP_MIN_WIDTH as u16, APP_MAX_WIDTH as u16
|
||||
));
|
||||
ui.add(Slider::new(
|
||||
&mut self.selected_width,
|
||||
APP_MIN_WIDTH as u16..=APP_MAX_WIDTH as u16,
|
||||
))
|
||||
.on_hover_text(GUPAX_WIDTH);
|
||||
});
|
||||
ui.add_enabled_ui(self.ratio != Ratio::Height, |ui| {
|
||||
let description = format!(
|
||||
" Width [{}-{}]:",
|
||||
APP_MIN_WIDTH as u16, APP_MAX_WIDTH as u16
|
||||
);
|
||||
slider_state_field(
|
||||
ui,
|
||||
&description,
|
||||
GUPAX_WIDTH,
|
||||
&mut self.selected_width,
|
||||
APP_MIN_WIDTH as u16..=APP_MAX_WIDTH as u16,
|
||||
);
|
||||
});
|
||||
ui.add_enabled_ui(self.ratio != Ratio::Width, |ui| {
|
||||
let description = format!(
|
||||
" Height [{}-{}]:",
|
||||
APP_MIN_HEIGHT as u16, APP_MAX_HEIGHT as u16
|
||||
);
|
||||
slider_state_field(
|
||||
ui,
|
||||
&description,
|
||||
GUPAX_HEIGHT,
|
||||
&mut self.selected_height,
|
||||
APP_MIN_HEIGHT as u16..=APP_MAX_HEIGHT as u16,
|
||||
);
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
ui.add_enabled_ui(self.ratio != Ratio::Width, |ui| {
|
||||
ui.label(format!(
|
||||
" Height [{}-{}]:",
|
||||
APP_MIN_HEIGHT as u16, APP_MAX_HEIGHT as u16
|
||||
));
|
||||
ui.add(Slider::new(
|
||||
&mut self.selected_height,
|
||||
APP_MIN_HEIGHT as u16..=APP_MAX_HEIGHT as u16,
|
||||
))
|
||||
.on_hover_text(GUPAX_HEIGHT);
|
||||
});
|
||||
});
|
||||
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(
|
||||
Slider::new(
|
||||
&mut self.selected_scale,
|
||||
|
|
Loading…
Reference in a new issue