From 699596835e682f1a0c42e213ff5fe4b9f7db9683 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 2 Nov 2026 14:11:23 +0700 Subject: [PATCH] Image menu: scroll a long list; the test speaks English With many images, the list now scrolls so Import... and the items after it stay on screen. The UI test sets English, as a first run would speak the system's language. --- crates/ui-egui/src/dock.rs | 11 +++++++---- crates/ui-egui/tests/fill_channel_image.rs | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rs index 896079c1..0220bae3 100644 --- a/crates/ui-egui/src/dock.rs +++ b/crates/ui-egui/src/dock.rs @@ -849,11 +849,14 @@ pub(crate) fn texture_set_settings(app: &mut TextureCraftApp, ui: &mut Ui) { fn image_menu(app: &mut TextureCraftApp, ui: &mut Ui) -> Option { ui.label(caption(tr("Images"))); let mut picked = None; - for name in app.session.doc.resources.keys() { - if ui.button(name.as_str()).clicked() { - picked = Some(name.clone()); + // Bounded, so Import... and the items after it stay on screen with many images. + egui::ScrollArea::vertical().id_salt("image_menu").max_height(240.0).show(ui, |ui| { + for name in app.session.doc.resources.keys() { + if ui.button(name.as_str()).clicked() { + picked = Some(name.clone()); + } } - } + }); if ui.button(tr("Import...")).clicked() { crate::menus::invoke(app, ui.ctx(), "resource.import"); ui.close(); diff --git a/crates/ui-egui/tests/fill_channel_image.rs b/crates/ui-egui/tests/fill_channel_image.rs index 37663e6d..b87a0052 100644 --- a/crates/ui-egui/tests/fill_channel_image.rs +++ b/crates/ui-egui/tests/fill_channel_image.rs @@ -15,6 +15,8 @@ fn a_fill_channel_takes_an_image_from_its_source_menu() { let out = texturecraft_engine::execute(&mut session, "layer.add.fill", &json!({"roughness": 0.6})).unwrap(); let layer = LayerId(out["layer"].as_u64().unwrap()); let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1400.0)).build_eframe(|cc| TextureCraftApp::new(cc, session)); + // The labels below are English; a first run would speak the system's language. + h.state_mut().ui.prefs.language = "en".into(); h.run_steps(4); // The source menu button sits in the row of the channel's name.