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

Fix reports being shown out of screen #2420

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

lmoureaux
Copy link
Contributor

When connecting to a game and receiving an historian report, they would often be shown out-of-screen. This is ultimately caused by the resizing of the client window happening only after the game state is fully loaded. The placement algorithm has to provide sensible results when the widget doesn't fit inside the (small) base window size.

The complicated placement algorithm relied on an initial guess for the position and could result in the widget being shown off-screen when the window was too small. Replace it with a linear scan going left-to-right and top-to-bottom across the entire screen. Also avoid recursion, permitting more attempts by lifting the limitation due to the stack size.

This doesn't entirely solve the issue of widgets being shown in an unexpected location when connecting to a game: when the algorithm finds no solution, it now defaults to 0,0 to maximize visible content. This can in particular be the case for the small window size used right before connecting. I think a full revision of the pregame screens is needed, but this is way beyond the scope of this PR and won't make it to 3.1.

Closes #1989.

Before Patch

image

After Patch

image

The Demographics report gets placed correctly when invoked:

image

When connecting to a game and receiving an historian report, they would
often be shown out-of-screen. This is ultimately caused by the resizing
of the client window happening only after the game state is fully
loaded. The placement algorithm has to provide sensible results when the
widget doesn't fit inside the (small) base window size.

The complicated placement algorithm relied on an initial guess for the
position and could result in the widget being shown off-screen when the
window was too small. Replace it with a linear scan going left-to-right
and top-to-bottom across the entire screen. Also avoid recursion,
permitting more attempts by lifting the limitation due to the stack
size.

This doesn't entirely solve the issue of widgets being shown in an
unexpected location when connecting to a game: when the algorithm finds
no solution, it now defaults to 0,0 to maximize visible content. This
can in particular be the case for the small window size used right
before connecting. I think a full revision of the pregame screens is
needed, but this is way beyond the scope of this PR and won't make it to
3.1.

Closes longturn#1989.
Copy link
Collaborator

@jwrober jwrober left a comment

Choose a reason for hiding this comment

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

Works for me!

@jwrober jwrober merged commit 74285da into longturn:master Oct 28, 2024
21 checks passed
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.

Historian report goes off the screen
2 participants