-
-
Notifications
You must be signed in to change notification settings - Fork 32
Draw minimap with correct aspect ratio #485
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
Conversation
I think that a good solution should have these properties:
|
Yes, your drawing illustrates well what I meant. You are right about the action bar, it should horizontally end where the minimap begins. |
|
Got a bit stuck on this one, it seems to me like the aspect ratio constraint works only in only one direction while the other has a size constraint, but other than that it might not be able to "expand to fit" with just the vanilla Also feedback on the new code layout is welcome, since the bottom HUD is now a flexbox so a hierarchy is needed. Right now, I have the container defined in |
I would try to explore the padding trick (https://css-tricks.com/aspect-ratio-boxes/). If that doesn't lead anywhere, we might need to implement a system which on change of the window resolution recalculates the sizes of the nodes and changes them. This should be pretty simple system and a small modification.
I would try to minimize changes in this PR and postpone any unnecessary code structuring changes to a separate PR. I'll do a proper review once we arrive at a solution which works. I quickly tried to find a simple solution in which we do not have to (re)calculate the size in a system, but without success. |
I also actually wish to not do this here. The logic was that technically when the minimap size changes, there's a gap/overlap between it and the action bar, but I guess that might be a non-issue at this point.
Couldn't get this to work, might just be me, although I think it's the fact that we want to constrain the size in both directions while maintaining the aspect ratio, and have it expand to the max size possible. Everything I've seen just shows a size constraint on one axis, while the aspect ratio controls the other. |
We will limit the aspect ration for maps anyways (#375) so setting just height (or width) and leaving the other dimension to grow/shrink might be sufficient. Would that be easier to achieve? |
I think that would be significantly easier. For example, fix the width to 20% of the screen, and have the maps only be wide rectangles (or do the opposite and fix the height, whichever). With this approach, even if we allow the opposite aspect ratio, we could just rotate the map a quarter turn and get the shape we want. Would also make the visuals more consistent imo. |
Ok, so lets rework the implementation in this PR so that the width is fixed at 20%. We can limit aspect ratio of the maps from 2:1 to 1:1. |
For now we only constrain width. Fixes DigitalExtinction#376


Fixes #376