Skip to content

Fix toggle buttons covering Back button in ConfigScreen#355

Merged
dmccoystephenson merged 3 commits into
mainfrom
copilot/fix-toggle-buttons-overlap
Apr 23, 2026
Merged

Fix toggle buttons covering Back button in ConfigScreen#355
dmccoystephenson merged 3 commits into
mainfrom
copilot/fix-toggle-buttons-overlap

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

With 9 toggles and a fixed ypos increment, ConfigScreen overflows and buries the Back button. Refactors drawMenuButtons() to use the same scrollable-row pattern already established in ControlsScreen.

Changes

src/screen/configScreen.py

  • Scrollable toggle listdrawMenuButtons() now calculates visibleRows from available vertical space (reserving 80px for the bottom strip), clamps scrollOffset, and renders only the visible slice. A "1–N of 9" indicator appears when content overflows.
  • Fixed Back buttondrawBackButton() replaced by drawBottomButtons(), which always renders at y - 45 regardless of toggle count, matching ControlsScreen.drawBottomButtons().
  • Mouse wheel scroll — added handleScrollEvent(event) and wired pygame.MOUSEWHEEL in run().
  • Visual consistencyrowHeight = 35, buttonHeight = 28, and bottom margin match ControlsScreen values exactly.
  • scrollOffset lifecycle — initialized to 0 in __init__, reset to 0 on each run() entry.
# Before: fixed ypos, drawBackButton() called from inside drawMenuButtons()
ypos = 70
for label, attribute in toggleButtons:
    self.graphik.drawButton(xpos, ypos, width, height, ...)
    ypos += height + margin
self.drawBackButton()  # covered once ypos exceeds screen height

# After: scrollable slice + fixed bottom strip
visibleRows = int((y - startY - 80) / rowHeight)
self.scrollOffset = max(0, min(self.scrollOffset, maxOffset))
for i, (label, attribute) in enumerate(toggleButtons[self.scrollOffset:self.scrollOffset + visibleRows]):
    self.graphik.drawButton(xpos, startY + i * rowHeight, width, buttonHeight, ...)
# Back button drawn separately, always at y - 45
self.drawBottomButtons()

Agent-Logs-Url: https://github.com/Preponderous-Software/roam/sessions/dda4c3b1-3a83-48ce-8691-d1c58e501480

Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix toggle buttons covering back button in settings screen Fix toggle buttons covering Back button in ConfigScreen Apr 23, 2026
Copilot AI requested a review from dmccoystephenson April 23, 2026 05:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors ConfigScreen settings toggles to be scrollable so the Back button remains visible even when the toggle list overflows the screen.

Changes:

  • Implemented a scrollable, row-based rendering for config toggles (with overflow indicator).
  • Replaced the old back-button drawing logic with a fixed-position bottom button strip.
  • Added mouse-wheel scrolling support and reset scroll state on screen entry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/screen/configScreen.py Introduces scrollable toggle rendering, mouse wheel scrolling, and a fixed bottom Back button to prevent UI overflow from covering navigation.
CHANGELOG.md Documents the UI refactor session and notes test status.

Comment thread src/screen/configScreen.py Outdated
Comment on lines +62 to +66
visibleRows = int((y - startY - 80) / rowHeight) # 80px reserved for bottom Back button
maxOffset = max(0, len(toggleButtons) - visibleRows)
self.scrollOffset = max(0, min(self.scrollOffset, maxOffset))

visibleToggles = toggleButtons[self.scrollOffset : self.scrollOffset + visibleRows]
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

visibleRows can become 0 (or negative) if the window height is small enough, which makes maxOffset and the slice math inconsistent (e.g., scroll offset can clamp beyond the last item and the range indicator can show something like "10-9 of 9", and no toggles render). Consider clamping visibleRows to at least 1 (or early-return with a message) before computing maxOffset/slicing.

Copilot uses AI. Check for mistakes.
@dmccoystephenson
Copy link
Copy Markdown
Member

@copilot address comment

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 23, 2026

@copilot address comment

Fixed in 2c90265visibleRows is now clamped to max(1, ...) so the slice math and range indicator remain valid even at very small window heights.

@dmccoystephenson dmccoystephenson marked this pull request as ready for review April 23, 2026 05:51
@dmccoystephenson dmccoystephenson merged commit cf45130 into main Apr 23, 2026
1 check passed
@dmccoystephenson dmccoystephenson deleted the copilot/fix-toggle-buttons-overlap branch April 23, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix toggle buttons covering 'Back' button in settings screen

3 participants