Start the option rows under the tab bar and pin Return to the bottom - #473
Merged
Conversation
Both tabs dropped the spacer above their rows, so the list starts under the tab strip. Return is pinned to the bottom by pinMenuRowToBottom(): an auto top margin takes the leftover space, and a flex basis of one row height reserves the row so the siblings cannot grow into it. Setting only a height does not work, because makeMenuRow leaves a flex basis of 0 that wins over it, which collapsed the row and lost its highlight. Row heights now track the menu font instead of a flat 110 px, and are applied in recalculateLayout() where the window width is known, so they follow a resize. At 1280x720 the old fixed height let the rows fill the column and Return collided with the Shadow Map dots. The Keyboard tab fills its column, so Reset to Defaults carries a bottom margin to keep it clear of Return.
The pad reports a second down/up 3-6ms after a button is really released. That extra edge fired the action twice: a checkbox toggled off and back on, and Return closed the options screen and then reopened it from the menu underneath. The old latch cleared the moment the action stopped being held, and the bounce lands after the release, so it went straight through. Anchor the latch to the release instead: hold it until the action has been let go for a continuous 50ms, well above the bounce and well under a deliberate second press. Cursor drift no longer takes the device from the gamepad either. A resting hand clears half a pixel, which flipped the active device to keyboard mid press and let the driver's aliased key through as a second edge. It now waits for the gamepad grace, while a mouse click still switches at once. Menus arm the wait-for-release when a screen above them closes. Both menus set wasActiveLastFrame unconditionally, so the flag was never false on the frame the options screen handed input back and the guard never armed.
The tab set wasActiveLastFrame unconditionally, so the flag was never false on the frame a capture handed input back and the wait-for-release guard never armed. Binding a key that also confirms, Enter or Space, left the key still held as the row went live again and the menu reopened the capture on the next edge. Gate the guard and the flag on the same condition the actions already use, matching the intro and exit menus.
MSVC warns C4458 on the local, and the CI build turns warnings into errors. Nothing shadows the base class member now, and takesInput says what the flag means: this menu is the one reading input this frame.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Both option tabs start their rows under the tab strip instead of below a spacer, and Return sits at the bottom of the column on both, at the same y.
ui::pinMenuRowToBottom()does the anchoring: an auto top margin takes the leftover space, and a flex basis of one row height reserves the row.The basis is the part that matters.
makeMenuRowcallsYGNodeStyleSetFlex(child, 1.F), which leaves a flex basis of 0, and that wins over aheight. Setting only the height collapsed Return to 0 px: the label still drew at the row's top edge, so it looked right, but the highlight quad had no height and the mouse had nothing to hit. Logging the node heights showed82 81 82 81 82 82 0in a 561 px column. With the basis set they come out80 80 80 79 80 80 82.Spacing scales with resolution
Row heights track the menu font (
menuRowHeight()= 3.4 x the font size) rather than a flat 110 px, and are applied inrecalculateLayout(), where the window width is known, so a resize carries them. At 1280x720 the old fixed height let seven rows fill the column and Return overlapped the Shadow Map dots.makeMenuRowkeeps its 110 px cap, so the intro and exit menus are unchanged.The Keyboard tab fills its column, so Reset to Defaults carries a bottom margin that keeps it off Return.
Testing
Built and driven with synthesised input at two window sizes.
pre-commit runis clean on the three changed files.2560 and above (font 48, rows capped at 163 px) is untested, since no display here reaches it.