1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Mainmenu: Avoid the header being displayed behind the formspec (#13924)

This change keeps the current header placement code, but adds additional code to make sure the header doesn't end up behind the formspec.
This commit is contained in:
grorp 2023-11-25 17:04:33 +01:00 committed by GitHub
parent 6783734612
commit 4255ac3022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 10 deletions

View file

@ -247,6 +247,14 @@ std::vector<std::string>* GUIFormSpecMenu::getDropDownValues(const std::string &
return NULL;
}
// This will only return a meaningful value if called after drawMenu().
core::rect<s32> GUIFormSpecMenu::getAbsoluteRect()
{
core::rect<s32> rect = AbsoluteRect;
rect.UpperLeftCorner.Y += m_tabheader_upper_edge;
return rect;
}
v2s32 GUIFormSpecMenu::getElementBasePos(const std::vector<std::string> *v_pos)
{
v2f32 pos_f = v2f32(padding.X, padding.Y) + pos_offset * spacing;
@ -2104,6 +2112,7 @@ void GUIFormSpecMenu::parseTabHeader(parserData* data, const std::string &elemen
e->setActiveTab(tab_index);
m_fields.push_back(spec);
m_tabheader_upper_edge = MYMIN(m_tabheader_upper_edge, rect.UpperLeftCorner.Y);
}
void GUIFormSpecMenu::parseItemImageButton(parserData* data, const std::string &element)
@ -3105,6 +3114,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
m_formspec_version = 1;
m_bgcolor = video::SColor(140, 0, 0, 0);
m_tabheader_upper_edge = 0;
{
v3f formspec_bgcolor = g_settings->getV3F("formspec_fullscreen_bg_color");