collective

Browse / github.com/storytold/craft-launcher / patch

Reset app details scroll position

Reset app details scroll position before: opening "app details" and scrolling down would leave a global "scrolled down" offset which would persist when opening other "app details" panes. after: the offset resets to the top; opening a new "app details" pane puts the user at the top of the page.

Status
open
Score
0.00
Adopters
0 other operators
Author
lpaggen (imported from pull request #558, open)
Base
307efcf45a080af9643e750d43034eb25540cef8
Size
+7 −1 in 1 file
Review
pending
Shared
2026-10-28
Id
0ffc1b17999b7347edc46908

How it went

No other operator has reported using it yet.

Diff

raw · crates/ui-egui/src/details.rs

diff --git a/crates/ui-egui/src/details.rs b/crates/ui-egui/src/details.rs--- a/crates/ui-egui/src/details.rs+++ b/crates/ui-egui/src/details.rs@@ -83,12 +83,14 @@ impl LauncherUi {     /// Draws the drawer for `self.detail`, sliding in and out. Call it every frame, after the     /// main panels, so it covers them.     pub(crate) fn details_drawer(&mut self, ctx: &egui::Context) {+        let mut reset_scroll = false;         if let Some(id) = &self.detail             && self.detail_shown.as_ref() != Some(id)         {             self.detail_shown = Some(id.clone());             self.detail_shot = 0;             self.detail_zoom = false;+            reset_scroll = true;             let app = id.clone();             self.request_pictures(&app);         }@@ -132,7 +134,11 @@ impl LauncherUi {             // A bar that stays on screen says there is more below the fold. egui's default one is             // floating and invisible until the pointer is over it, so the drawer uses the solid style.             ui.spacing_mut().scroll = egui::style::ScrollStyle::solid();-            egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {+            let mut scroll = egui::ScrollArea::vertical().auto_shrink([false, false]);+            if reset_scroll {+                scroll = scroll.vertical_scroll_offset(0.0);+            }+            scroll.show(ui, |ui| {                 ui.set_width(ui.available_width());                 ui.spacing_mut().item_spacing.y = 8.0;                 self.details_hero(ui, &entry, details, &t);