-
Notifications
You must be signed in to change notification settings - Fork 2k
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
GUITable: Scale images with display density / row height #14709
base: master
Are you sure you want to change the base?
Conversation
This PR has undergone more transformation so that it is a pure bugfix now. Example case on desktop: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I had to change the approach to display density scaling used in this PR again. With the previous approach, the icons were too big proportionally to the row height on my Android device: Because the row height is derived from the font size and the default font size is lower (14 instead of 16) on Android, the images were more affected by the higher display density than the row height was. To fix this, I've made image scaling respect font size as well. |
Fixes #3403, opened in 2015
5.8.1
![screenshot on 5.8.1](https://private-user-images.githubusercontent.com/82708541/333907317-d9099ea7-fa3f-4540-a3e0-ab547544c4cf.jpeg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1MzgxMzYsIm5iZiI6MTcxOTUzNzgzNiwicGF0aCI6Ii84MjcwODU0MS8zMzM5MDczMTctZDkwOTllYTctZmEzZi00NTQwLWEzZTAtYWI1NDc1NDRjNGNmLmpwZWc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOFQwMTIzNTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hMjUyOGU5Yzg1ZDQ1MDJjZDE0Y2E1NDYwNWY2M2E4NjlhYWVmMDBjODQxODJhY2IxY2ZiYjZiZjVkZTEzOGZjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Fb_aXTZjRASAxWF6GNqh1yVlC5O51tBLgPBaDN04hbs)
this PR
![screenshot on this PR](https://private-user-images.githubusercontent.com/82708541/333907315-a974b6ed-b7f7-4c45-ae28-9a684bd89b68.jpeg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1MzgxMzYsIm5iZiI6MTcxOTUzNzgzNiwicGF0aCI6Ii84MjcwODU0MS8zMzM5MDczMTUtYTk3NGI2ZWQtYjdmNy00YzQ1LWFlMjgtOWE2ODRiZDg5YjY4LmpwZWc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOFQwMTIzNTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05YjExZWMxOTkxNGM2OTJhMzQ3ZmMxNTNmZjQ3MWIxZDA0ODQzYTNjZjk1YjJjZTU4MzVkNjQxZDU3ZjJhOWZkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.5fJphM6eU4taVy6I5eP8aHwmIB7juHvpjIFa0FoBlu0)
Offtopic complaints
Something you can also see very well on these screenshots is that the mainmenu is way too small by default on Android, at least on my device. With proper scaling, the serverlist would be much more readable. This PR with
gui_scaling = 1.3
:While you can set
gui_scaling
manually to get reasonable scaling (except for the scrollbars, which are too big now), you shouldn't have to do that. Minetest should use a reasonable fraction of the screen by default.To do
This PR is a Ready for Review.
If you find a case where this PR makes an existing formspec look worse, please tell me. However, this isn't very likely to happen anymore with the latest commit. Zipgrep: https://web.archive.org/web/20240530091120/https://content.minetest.net/zipgrep/62090fd0-3f2e-4806-b04c-53cd5e8a20f1/
How to test
Look at the Devtest test formspec, "Table" tab. Verify that what you see matches what the code requests.
Look at the serverlist on a device with a high display density.