[pr-fix][input] F1: the lists stay put under the mouse; the wheel scrolls them; tabs light on hover #297

Open
berkai wants to merge 1 commit from berkai/f1-menu-scroll into main AGit
First-time contributor

Contributor role (optional)

  • Fluxer ID: berkai#3659

What it changes

  • The problem on main: seen in the game with the new tabbed F1 menu (380a066). Hovering a row moves the list under the mouse.

Every F1 list (the settings of a tab, IMPORT's saves, KEY BINDINGS, AUTO-DETECT's changes) was centred on the highlighted row (at.saturating_sub(ROWS / 2)). Hovering highlights the row under the mouse, so with 9 rows shown the list slid away under the cursor at almost every move. Hovering the tab strip jumped the settings list back to its top, and hovering a button jumped it to its end. The wheel moved the highlight instead of the list, and wrapped around the ends.

This keeps each list's scroll position, as desktop lists do:

  • Hovering a row, a tab or a button highlights it, and the list does not move.
  • The arrow keys scroll only when the highlight steps past the top or bottom edge, one line at a time. Wrapping around the end shows that end.
  • The wheel scrolls the list by Windows' "lines per notch" setting (3 by default; a full page for "one screen at a time") and stops at the ends. After it scrolls, the row under the mouse is highlighted. With the mouse elsewhere, the highlighted row stays if it is still shown, else the nearest shown row is highlighted.
  • Another tab starts its list at the top. A list that fits in the box does not move with the wheel.
  • A tab (or the Q / E box) under the mouse is lit: a soft pill inside the dividers, with the name in the text colour. The dividers stay drawn.

All in crates/darner-gpu/src/host/menu.rs.

How it was tested

  • Tested revision: 4e6e80d (on f3840d7)
  • Commands and results:
    • cargo test --locked -p darner-gpu --lib menu: 57 passed, 0 failed, 2 ignored. New tests: wheel_scrolls_the_list_and_drains_notches (rewritten), a_list_scrolls_only_past_its_edge_never_under_the_mouse, a_tab_under_the_mouse_is_lit. One assertion in hit_test_finds_rows_tabs_and_buttons_where_they_are_drawn changed on purpose: with a button picked, the list now stays where it was instead of jumping to its end.
    • cargo clippy -p darner-gpu --all-targets --locked -- -D warnings: clean
    • cargo clippy -p darner-gpu --all-targets --all-features --locked -- -D warnings: clean
    • cargo xtask policy --staged: ok
  • Changes a default: no (F1 menu mouse and scroll behaviour only)
  • A/B result: not applicable (no speed claim, no default switch)
  • Gates run on that revision: the narrow ones above for darner-gpu. Not the full cargo test --workspace.
  • Gameplay, when relevant: F1 menu hover, wheel and tab hover checked in the game with a --profile fast build. GPU: NVIDIA GeForce RTX 4060 Ti.
  • Hardware dependence: likely general (menu input and drawing only)
  • Coverage gaps: the pad was not tried; the wheel with "one screen at a time" was not tried in the game.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #154 (a second full-screen F1 look in menu/look.rs; it does not change how the current lists scroll). Other open PRs touching menu.rs add rows or text only: #289, #255, #217, #205, #196, #175, #146, #145, #143, #80, #75, #48, #47, #16, #12, #9.
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: berkai#3659 ## What it changes - The problem on main: seen in the game with the new tabbed F1 menu (380a066). Hovering a row moves the list under the mouse. Every F1 list (the settings of a tab, IMPORT's saves, KEY BINDINGS, AUTO-DETECT's changes) was centred on the highlighted row (`at.saturating_sub(ROWS / 2)`). Hovering highlights the row under the mouse, so with 9 rows shown the list slid away under the cursor at almost every move. Hovering the tab strip jumped the settings list back to its top, and hovering a button jumped it to its end. The wheel moved the highlight instead of the list, and wrapped around the ends. This keeps each list's scroll position, as desktop lists do: - Hovering a row, a tab or a button highlights it, and the list does not move. - The arrow keys scroll only when the highlight steps past the top or bottom edge, one line at a time. Wrapping around the end shows that end. - The wheel scrolls the list by Windows' "lines per notch" setting (3 by default; a full page for "one screen at a time") and stops at the ends. After it scrolls, the row under the mouse is highlighted. With the mouse elsewhere, the highlighted row stays if it is still shown, else the nearest shown row is highlighted. - Another tab starts its list at the top. A list that fits in the box does not move with the wheel. - A tab (or the Q / E box) under the mouse is lit: a soft pill inside the dividers, with the name in the text colour. The dividers stay drawn. All in `crates/darner-gpu/src/host/menu.rs`. ## How it was tested - Tested revision: 4e6e80d (on f3840d7) - Commands and results: - `cargo test --locked -p darner-gpu --lib menu`: 57 passed, 0 failed, 2 ignored. New tests: `wheel_scrolls_the_list_and_drains_notches` (rewritten), `a_list_scrolls_only_past_its_edge_never_under_the_mouse`, `a_tab_under_the_mouse_is_lit`. One assertion in `hit_test_finds_rows_tabs_and_buttons_where_they_are_drawn` changed on purpose: with a button picked, the list now stays where it was instead of jumping to its end. - `cargo clippy -p darner-gpu --all-targets --locked -- -D warnings`: clean - `cargo clippy -p darner-gpu --all-targets --all-features --locked -- -D warnings`: clean - `cargo xtask policy --staged`: ok - Changes a default: no (F1 menu mouse and scroll behaviour only) - A/B result: not applicable (no speed claim, no default switch) - Gates run on that revision: the narrow ones above for `darner-gpu`. Not the full `cargo test --workspace`. - Gameplay, when relevant: F1 menu hover, wheel and tab hover checked in the game with a `--profile fast` build. GPU: NVIDIA GeForce RTX 4060 Ti. - Hardware dependence: likely general (menu input and drawing only) - Coverage gaps: the pad was not tried; the wheel with "one screen at a time" was not tried in the game. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #154 (a second full-screen F1 look in `menu/look.rs`; it does not change how the current lists scroll). Other open PRs touching `menu.rs` add rows or text only: #289, #255, #217, #205, #196, #175, #146, #145, #143, #80, #75, #48, #47, #16, #12, #9. - Replaces or overlaps: none found
Each list of the F1 menu (the settings, IMPORT's saves, KEY BINDINGS,
AUTO-DETECT's changes) was centred on the line picked. Hovering picks the
row under the mouse, so with 9 rows shown the list slid away under it at
almost every move; hovering the tabs jumped the settings to their top, and
hovering a button to their end. The wheel stepped the line picked, round
the ends, rather than scrolling.

Now each list keeps where it was scrolled (another page starts at its top).
It moves only to show a line stepped to past its edge, by that line, or for
the wheel: by Windows' wheel lines (3 by default; a page for "one screen at
a time"), stopping at the ends, the line under the mouse picked after. A tab
or the Q or E box under the mouse is lit: a soft pill inside the dividers,
the name in the text colour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
First-time contributor

There are two Windows wheel settings that this branch interprets differently from the system. A setting of zero disables wheel scrolling, and a value larger than the visible list scrolls by one page. With a nine-row viewport, the current code scrolls one row for 0 and fourteen rows for 14. Microsoft's mouse input documentation

I prepared a cherry-pickable follow-up which keeps zero disabled and caps one notch at the visible row count, including the page-scroll value. A fixture with the production scroll logic verified 0, 3, 14 and WHEEL_PAGESCROLL. It returned 0, 3, 9 and 9 rows with the follow-up. The new in-tree test supplies the setting directly, and the focused Cargo type check and asset policy passed.

If you cherry-pick or rebase the contribution, please keep the Git author. If you fold it into your own commit, please add this trailer.

Co-authored-by: andrewpozdnakov7-jpg <[email protected]>

There are two Windows wheel settings that this branch interprets differently from the system. A setting of zero disables wheel scrolling, and a value larger than the visible list scrolls by one page. With a nine-row viewport, the current code scrolls one row for `0` and fourteen rows for `14`. [Microsoft's mouse input documentation](https://learn.microsoft.com/en-us/windows/win32/inputdev/about-mouse-input) I prepared a [cherry-pickable follow-up](https://git.gtahub.st/andrewpozdnakov7-jpg/Darner/commit/248f59eb2e842071f05bd377f31660b862e625ff) which keeps zero disabled and caps one notch at the visible row count, including the page-scroll value. A fixture with the production scroll logic verified `0`, `3`, `14` and `WHEEL_PAGESCROLL`. It returned `0`, `3`, `9` and `9` rows with the follow-up. The new in-tree test supplies the setting directly, and the focused Cargo type check and asset policy passed. If you cherry-pick or rebase the contribution, please keep the Git author. If you fold it into your own commit, please add this trailer. `Co-authored-by: andrewpozdnakov7-jpg <296776509+[email protected]>`
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/297/head:berkai/f1-menu-scroll'
git switch 'berkai/f1-menu-scroll'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'berkai/f1-menu-scroll'
git switch 'berkai/f1-menu-scroll'
git rebase 'main'
git switch 'main'
git merge --ff-only 'berkai/f1-menu-scroll'
git switch 'berkai/f1-menu-scroll'
git rebase 'main'
git switch 'main'
git merge --no-ff 'berkai/f1-menu-scroll'
git switch 'main'
git merge --squash 'berkai/f1-menu-scroll'
git switch 'main'
git merge --ff-only 'berkai/f1-menu-scroll'
git switch 'main'
git merge 'berkai/f1-menu-scroll'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!297
No description provided.