mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
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:
parent
48d5d54b77
commit
11b44b78f7
3 changed files with 5 additions and 9 deletions
|
|
@ -11,12 +11,8 @@ end
|
||||||
|
|
||||||
tostring_overrides["display.gui-scale"] = function(x)
|
tostring_overrides["display.gui-scale"] = function(x)
|
||||||
if x == 0 then
|
if x == 0 then
|
||||||
return string.format("%s (%d)", gui.str("Auto"), gui.get_max_scale())
|
-- the scale chosen automatically for the current window
|
||||||
end
|
return string.format("%s (%s)", gui.str("Auto"), tostring(gui.get_scale()))
|
||||||
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))
|
|
||||||
end
|
end
|
||||||
return tostring(x)
|
return tostring(x)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ Description=Описание
|
||||||
Converting world...=Выполняется конвертация мира...
|
Converting world...=Выполняется конвертация мира...
|
||||||
Unlimited=Неограниченно
|
Unlimited=Неограниченно
|
||||||
Auto=Авто
|
Auto=Авто
|
||||||
Effective=действует
|
|
||||||
Chat=Чат
|
Chat=Чат
|
||||||
Console=Консоль
|
Console=Консоль
|
||||||
Log=Лог
|
Log=Лог
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,10 @@ float GUI::calcScale(const glm::uvec2& viewport) const {
|
||||||
? static_cast<float>(calcMaxScale(viewport)) // auto
|
? static_cast<float>(calcMaxScale(viewport)) // auto
|
||||||
: value;
|
: 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();
|
auto& page = menu->getCurrent();
|
||||||
if (page.panel) {
|
if (value <= 0.0f && page.panel) {
|
||||||
auto size = page.panel->getSize();
|
auto size = page.panel->getSize();
|
||||||
if (size.x > 0.0f && size.y > 0.0f) {
|
if (size.x > 0.0f && size.y > 0.0f) {
|
||||||
float fit = std::min(viewport.x / size.x, viewport.y / size.y);
|
float fit = std::min(viewport.x / size.x, viewport.y / size.y);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue