Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appliance interaction menu is no longer cut off at the bottom #78353

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

moxian
Copy link
Contributor

@moxian moxian commented Dec 5, 2024

Summary

Bugfixes "Appliance interaction menu is no longer cut off at the bottom"

Purpose of change

Fixes #78177

Describe the solution

Let uilist do the sizing instead of trying to re-calculate the needed height in appliance interaction menu code.

Describe alternatives you've considered

Unlike the diff proposed by @ZhilkinSerg, I decided to leave the width of the input as it was - way wider than it needs to be - because I didn't see Serg's comment at the time of my commit I think it looks a bit better that way.

I think ideal solution would be to migrate the "header" of the interaction menu to imgui as well, but that's a bit beyond me for now.

Testing

tiles
20241204-233028-cataclysm-tiles

smol tiles
20241204-233041-cataclysm-tiles

curses
20241204-233502-VsDebugConsole

Additional context

two minor drive-by changes (i probably don't need to write this out but hey):

  • While i was debugging this thing trying to understand how layout works, i was getting weird values for locals. I'm very rusty with C++, but I think ImVec2 title_size = {}; creates uninitialized (rather than zeroed) value which might be UB and might be bad. So I changed those to ImVec2 title_size = ImVec2(); (since ImVec2 conveniently has a nice zero constructor like that). There is no change in behaviour, but the locals in the debugger look a bit less confusing now.
  • removed redundant imenu.setup(); in veh_app_interact::populate_app_actions(). The latter is only ever called in veh_app_interact::init_ui_windows(), and is always followed by imenu.setup(); anyway, so what's the point doing it twice.

@github-actions github-actions bot added Info / User Interface Game - player communication, menus, etc. Vehicles Vehicles, parts, mechanics & interactions [C++] Changes (can be) made in C++. Previously named `Code` Appliance/Power Grid Anything to do with appliances and power grid <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Dec 5, 2024
@moxian moxian marked this pull request as ready for review December 5, 2024 07:54
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 5, 2024
@moxian moxian changed the title Make appliance interaction menu fit without scrollbars Appliance interaction menu is no longer cut off at the bottom Dec 5, 2024
@Night-Pryanik Night-Pryanik merged commit 89cd888 into CleverRaven:master Dec 6, 2024
41 of 50 checks passed
@db48x
Copy link
Contributor

db48x commented Dec 6, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Appliance/Power Grid Anything to do with appliances and power grid astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Appliance use menu is cut off with scroll bars, last menu item only half visible when scrolling down.
3 participants