mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-10 05:17:24 +00:00
a6c1d5bbb9
Misscommunication if this was the right move or not. Leave the size as it was until someone has time to fix all buttons at once. This was SVN commit r26987.
36 lines
856 B
JavaScript
36 lines
856 B
JavaScript
function distributeButtonsHorizontally(button, captions)
|
|
{
|
|
const y1 = "100%-46";
|
|
const y2 = "100%-18";
|
|
switch (captions.length)
|
|
{
|
|
case 1:
|
|
button[0].size = "18 " + y1 + " 100%-18 " + y2;
|
|
break;
|
|
case 2:
|
|
button[0].size = "18 " + y1 + " 50%-5 " + y2;
|
|
button[1].size = "50%+5 " + y1 + " 100%-18 " + y2;
|
|
break;
|
|
case 3:
|
|
button[0].size = "18 " + y1 + " 33%-5 " + y2;
|
|
button[1].size = "33%+5 " + y1 + " 66%-5 " + y2;
|
|
button[2].size = "66%+5 " + y1 + " 100%-18 " + y2;
|
|
break;
|
|
}
|
|
}
|
|
|
|
function setButtonCaptionsAndVisibitily(button, captions, cancelHotkey, name)
|
|
{
|
|
captions.forEach((caption, i) => {
|
|
button[i] = Engine.GetGUIObjectByName(name + (i + 1));
|
|
button[i].caption = caption;
|
|
button[i].hidden = false;
|
|
button[i].onPress = () => {
|
|
Engine.PopGuiPage(i);
|
|
};
|
|
|
|
if (i == 0)
|
|
cancelHotkey.onPress = button[i].onPress;
|
|
});
|
|
}
|