Craft Anything: understand how any software works, and craft your own.
Rust
Hide the home scrollbar when scrolling is not needed (#988)
Vallenn843d56b0315a
diff --git a/crates/ui-egui/src/home.rs b/crates/ui-egui/src/home.rsindex aeb38e8f..db8965e3 100644--- a/crates/ui-egui/src/home.rs+++ b/crates/ui-egui/src/home.rs@@ -48,8 +48,9 @@ pub static TUTORIALS: &[(&str, &str, &str, &[&str])] = &[];pub fn show(app: &mut CraftApp, ui: &mut Ui) {- egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {- let full_w = ui.available_width();+ // Keep the content width stable while the scrollbar animates in and out.+ let full_w = (ui.available_width() - ui.spacing().scroll.allocated_width()).max(0.0);+ egui::ScrollArea::vertical().scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::VisibleWhenNeeded).auto_shrink([false, false]).show(ui, |ui| {let w = full_w.min(1000.0) - 48.0;let pad = ((full_w - w) / 2.0).max(24.0);// Tight enough that Start is in view at 900 px with every choice showing (tested).diff --git a/crates/ui-egui/tests/smoke.rs b/crates/ui-egui/tests/smoke.rsindex 97f72d27..6393e72b 100644--- a/crates/ui-egui/tests/smoke.rs+++ b/crates/ui-egui/tests/smoke.rs@@ -1967,6 +1967,27 @@ fn the_front_door_makes_something_or_just_looks_inside() {h.get_by_label("What do you want to recreate?");}+#[test]+fn new_project_does_not_shift_when_its_scrollbar_is_not_needed() {+ let mut h = harness_sized(egui::vec2(1000.0, 700.0), || demo::app(demo::engine(Mode::Beginner, true)));+ h.run_steps(3);+ let make_left = h.get_by_label("What do you want to make?").rect().left();+ assert!(+ h.query_all_by_role(egui::accesskit::Role::ScrollBar).any(|node| node.rect().left() > 200.0),+ "the overflowing Make page should show its scrollbar"+ );++ h.get_by_label("Just look inside").click();+ h.run_steps(20);+ let look_left = h.get_by_label("What do you want to look inside?").rect().left();++ assert_eq!(look_left, make_left, "removing the scrollbar must not recenter New project");+ assert!(+ h.query_all_by_role(egui::accesskit::Role::ScrollBar).all(|node| node.rect().left() <= 200.0),+ "the short Just look inside page should not show a scrollbar"+ );+}+#[test]fn a_running_build_says_what_it_is_on_and_opens_up_into_its_activity() {use craft_anything_ai::rebuild::{RunEvent, RunSet, StandIns};diff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex b018cd91..f0c14532 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -675,6 +675,9 @@ Owner: maintainers · Status: in progress### R2.9 Everyday use: typing, projects, settingsOwner: maintainers · Status: in progressGaps found while using the app for real projects.+- [x] Keep New project's content column fixed while the vertical scrollbar animates in or out,+ hiding it when there is nothing to scroll, so switching tabs never shifts the page horizontally+ — claimed: Codex, branch bugfix/r2.9-home-scrollbar-gutter- [x] Agent paragraphs with glossary terms and long file links wrap together without pushingtheir card or later messages under the sidebar (#523); Project and Ask bounds checked at two sizes— claimed: carl-dourado, branch hotfix/r2.9-523-message-width