Mobile: don't stretch formspec to entire screen if it has a tabheader (#62)
This commit is contained in:
parent
3991e90bbc
commit
3cf9c06ae4
@ -3289,6 +3289,23 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
|||||||
mydata.screensize.X,
|
mydata.screensize.X,
|
||||||
mydata.screensize.Y
|
mydata.screensize.Y
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Try and find a tabheader[] element in the formspec
|
||||||
|
for (unsigned int j = i; j < elements.size(); j++) {
|
||||||
|
// This could use split() but since we don't parse parameters
|
||||||
|
// here it's probably faster to use find().
|
||||||
|
const size_t pos = elements[j].find('[');
|
||||||
|
if (pos == std::string::npos)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// If we find a tabheader then decrease padded_screensize.Y and
|
||||||
|
// stop searching through the formspec.
|
||||||
|
const std::string element_type = trim(elements[j].substr(0, pos));
|
||||||
|
if (element_type == "tabheader") {
|
||||||
|
padded_screensize.Y *= 0.9f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
// Pad the screensize with 5% of the screensize on all sides to ensure
|
// Pad the screensize with 5% of the screensize on all sides to ensure
|
||||||
// that even the largest formspecs don't touch the screen borders.
|
// that even the largest formspecs don't touch the screen borders.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user