Keep preferences window size stable
Gitea/Deckstride/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-11-21 15:35:07 +01:00
parent d41b8ab614
commit 3ca73d86cd
5 changed files with 38 additions and 11 deletions

2
Cargo.lock generated
View File

@ -670,7 +670,7 @@ dependencies = [
[[package]]
name = "deckstride"
version = "0.1.99"
version = "0.1.100"
dependencies = [
"bytemuck",
"chrono",

View File

@ -4,7 +4,7 @@ default-members = ["crates/deckstride"]
resolver = "3"
[workspace.package]
version = "0.1.99"
version = "0.1.100"
edition = "2024"
license = "MIT"
repository = "https://proxy.dandaedre.com/gitea/idle-org/deckstride"

View File

@ -2648,18 +2648,18 @@ fn preferences_window(ctx: &egui::Context, s: &mut Studio, open: &mut bool) {
});
ctx.data_mut(|data| data.insert_temp(tab_id, tab));
ui.separator();
let scroll_height = (ui.available_height() - 52.).max(180.);
// Reserve the close row, separator and both surrounding item gaps. If
// this is short by even one gap, the body asks the resizable window to
// grow again on every repaint.
let scroll_height = (ui.available_height() - 60.).max(180.);
egui::ScrollArea::vertical()
.id_salt(("preferences-scroll", tab as u8))
.auto_shrink([false, false])
.max_height(scroll_height)
.show(ui, |ui| {
ui.set_width(ui.available_width());
match tab {
PreferencesTab::General => general_preferences(ui, s),
PreferencesTab::Performance => performance_preferences(ui, s),
PreferencesTab::Storage => storage_preferences(ui, s),
}
.show(ui, |ui| match tab {
PreferencesTab::General => general_preferences(ui, s),
PreferencesTab::Performance => performance_preferences(ui, s),
PreferencesTab::Storage => storage_preferences(ui, s),
});
ui.separator();
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {

View File

@ -931,11 +931,17 @@ fn browser_thumbnails_fill_resized_window_without_stretching_tiles() {
#[test]
fn floating_windows_can_grow_and_shrink_after_content_is_drawn() {
for id in ["layout-window", "displays-window", "slide-preview"] {
for id in [
"layout-window",
"displays-window",
"preferences-window",
"slide-preview",
] {
let ctx = Context::default();
let mut s = studio();
s.layout_open = id == "layout-window";
s.displays_open = id == "displays-window";
s.preferences_open = id == "preferences-window";
if id == "slide-preview" {
s.browser_preview = Some((s.generation, 0));
}
@ -955,6 +961,22 @@ fn floating_windows_can_grow_and_shrink_after_content_is_drawn() {
frame(vec![]);
}
let rect = || ctx.memory(|m| m.area_rect(egui::Id::new(id))).unwrap();
if id == "preferences-window" {
let before = rect();
for offset in [
Vec2::new(20., 20.),
Vec2::new(-40., 80.),
Vec2::new(100., -60.),
Vec2::new(-120., -90.),
] {
frame(vec![egui::Event::PointerMoved(before.center() + offset)]);
}
let after = rect();
assert!(
(after.size() - before.size()).length() < 1.,
"Preferences must not resize on mouse movement: {before:?} -> {after:?}"
);
}
for delta in [Vec2::new(120., 80.), Vec2::new(-180., -180.)] {
let before = rect();
let start = before.right_bottom() - Vec2::splat(2.);

View File

@ -2,6 +2,11 @@
## Unreleased
### 0.1.100
- Keep the Preferences window size stable while the pointer moves by removing a
self-referential width constraint and reserving the full footer spacing.
### 0.1.99
- Organize Preferences into General, Performance and Storage tabs. Each tab has its