Merge pull request #742 from kdmukai/pre_scrolling_button_list_fix

[bugfix] Only apply auto-scroll `ButtonListScreen` logic for long lists that need it
This commit is contained in:
Nick Klockenga
2025-04-21 21:52:15 -04:00
committed by GitHub
2 changed files with 7 additions and 8 deletions
+7 -7
View File
@@ -326,14 +326,14 @@ class ButtonListScreen(BaseTopNavScreen):
button_list_y = self.top_nav.height
self.has_scroll_arrows = True
# How many buttons fit on the screen before we need to start scrolling?
num_buttons_pre_scroll = math.floor((self.canvas_height - button_list_y - GUIConstants.EDGE_PADDING) / (button_height + GUIConstants.LIST_ITEM_PADDING))
# How many buttons fit on the screen before we need to start scrolling?
num_buttons_pre_scroll = math.floor((self.canvas_height - button_list_y - GUIConstants.EDGE_PADDING) / (button_height + GUIConstants.LIST_ITEM_PADDING))
# Force a scroll offset when necessary if none was provided
if self.selected_button + 1 > num_buttons_pre_scroll and not self.scroll_y_initial_offset:
# Scroll far enough to expose the selected button; +1 to account for the
# height of the target button itself!
self.scroll_y_initial_offset = (button_height + GUIConstants.LIST_ITEM_PADDING) * (self.selected_button - num_buttons_pre_scroll + 1)
# Force a scroll offset when necessary if none was provided
if self.selected_button + 1 > num_buttons_pre_scroll and not self.scroll_y_initial_offset:
# Scroll far enough to expose the selected button; +1 to account for the
# height of the target button itself!
self.scroll_y_initial_offset = (button_height + GUIConstants.LIST_ITEM_PADDING) * (self.selected_button - num_buttons_pre_scroll + 1)
self.buttons: List[Button] = []
for i, button_option in enumerate(self.button_data):
-1
View File
@@ -169,7 +169,6 @@ def generate_screenshots(locale):
dict(
visibility=SettingsConstants.VISIBILITY__ADVANCED,
selected_attr=SettingsConstants.SETTING__ELECTRUM_SEEDS,
initial_scroll=240, # Just guessing how many pixels to scroll down
),
screenshot_name="SettingsMenuView__Advanced"
)