Apply explicit GUI scale as is

Explicitly chosen scale is no longer reduced to fit the open menu page
(2 stayed 1.5 in settings). Fitting to the window remains in auto mode.
This commit is contained in:
loki5512344 2026-10-03 13:31:38 +00:00
parent 48d5d54b77
commit 11b44b78f7
3 changed files with 5 additions and 9 deletions

View file

@ -11,12 +11,8 @@ end
tostring_overrides["display.gui-scale"] = function(x)
if x == 0 then
return string.format("%s (%d)", gui.str("Auto"), gui.get_max_scale())
end
local effective = gui.get_scale()
if effective ~= x then
-- menu is limited by window size
return string.format("%s (%s %s)", tostring(x), gui.str("Effective"), tostring(effective))
-- the scale chosen automatically for the current window
return string.format("%s (%s)", gui.str("Auto"), tostring(gui.get_scale()))
end
return tostring(x)
end

View file

@ -13,7 +13,6 @@ Description=Описание
Converting world...=Выполняется конвертация мира...
Unlimited=Неограниченно
Auto=Авто
Effective=действует
Chat=Чат
Console=Консоль
Log=Лог

View file

@ -110,9 +110,10 @@ float GUI::calcScale(const glm::uvec2& viewport) const {
? static_cast<float>(calcMaxScale(viewport)) // auto
: value;
// while a menu page is open, it must fit the window
// explicitly set scale is applied as is; in auto mode an open menu page
// must fit the window
auto& page = menu->getCurrent();
if (page.panel) {
if (value <= 0.0f && page.panel) {
auto size = page.panel->getSize();
if (size.x > 0.0f && size.y > 0.0f) {
float fit = std::min(viewport.x / size.x, viewport.y / size.y);