mirror of
https://github.com/ALLFATHER-BV/wadamesh.git
synced 2026-08-22 16:50:13 +00:00
fix: the Store no longer throws you back to the top while you scroll
Reported on device: open the Store, start scrolling, and it jumps back to the top a second later "when the status of the buttons update". luaStoreRebuildList() does lv_obj_clean() and rebuilds every row, and it is called from three ASYNC completions -- the catalog fetch, the SD card scan and the language catalog -- which land a second or two after the Store opens. That is exactly when someone is scrolling it. It now records the scroll offset and restores it after the rows exist, so the value is clamped against the NEW content height rather than the old one. This also explains a second report that looked unrelated: an app near the BOTTOM of the catalog appeared to have no Update button. The button was correct; the rebuild was scrolling it off screen before it could be seen. Verified on a T-Deck -- the app in question updated and now runs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f6b005e1be
commit
27d89ccb60
@@ -38790,6 +38790,14 @@ static void luaStoreTabCb(lv_event_t* e) {
|
||||
|
||||
static void luaStoreRebuildList() {
|
||||
if (!s_luastore_list) return;
|
||||
// Keep the reader where they were. This runs from ASYNC completions -- the
|
||||
// catalog fetch, the card scan, a language catalog -- which land a second or
|
||||
// two after the Store opens, i.e. exactly while someone is scrolling down it.
|
||||
// Rebuilding threw them back to the top every time, which also hid whatever
|
||||
// they had scrolled to (an app near the bottom could look like it had no
|
||||
// button at all). Restored after the rows exist, so the value is clamped
|
||||
// against the NEW content height rather than the old one.
|
||||
const lv_coord_t keep_scroll_y = lv_obj_get_scroll_y(s_luastore_list);
|
||||
lv_obj_clean(s_luastore_list);
|
||||
const uint32_t hide = touchPrefsGetAppHide();
|
||||
const lv_coord_t W = s_luastore_w;
|
||||
@@ -39196,6 +39204,10 @@ static void luaStoreRebuildList() {
|
||||
lv_obj_add_event_cb(b, luaStoreRemoveBtnCb, LV_EVENT_CLICKED, (void*)(intptr_t)i);
|
||||
}
|
||||
|
||||
if (keep_scroll_y > 0) {
|
||||
lv_obj_update_layout(s_luastore_list); // content height must be known first
|
||||
lv_obj_scroll_to_y(s_luastore_list, keep_scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
static void openLuaStorePage() {
|
||||
|
||||
Reference in New Issue
Block a user