source: ps/trunk/binaries/data/mods/mod/gui/common/utilities.js@ 25966

Last change on this file since 25966 was 25966, checked in by Silier, 3 years ago

There have been quite a bit of number of questions how to change scale of the gui, because this option is hidden from the user.

Use dropdown with values. Implement confirmation box with countdown to revert scale change because buttons can get unable to click.

Differential revision: D3037
Comments by: @vladislavbelov, @Stan, @wraitii, @pieq, @sera
Tested by: @Langbart

File size: 856 bytes
Line 
1function distributeButtonsHorizontally(button, captions)
2{
3 const y1 = "100%-46";
4 const y2 = "100%-18";
5 switch (captions.length)
6 {
7 case 1:
8 button[0].size = "18 " + y1 + " 100%-18 " + y2;
9 break;
10 case 2:
11 button[0].size = "18 " + y1 + " 50%-5 " + y2;
12 button[1].size = "50%+5 " + y1 + " 100%-18 " + y2;
13 break;
14 case 3:
15 button[0].size = "18 " + y1 + " 33%-5 " + y2;
16 button[1].size = "33%+5 " + y1 + " 66%-5 " + y2;
17 button[2].size = "66%+5 " + y1 + " 100%-18 " + y2;
18 break;
19 }
20}
21
22function setButtonCaptionsAndVisibitily(button, captions, cancelHotkey, name)
23{
24 captions.forEach((caption, i) => {
25 button[i] = Engine.GetGUIObjectByName(name + (i + 1));
26 button[i].caption = caption;
27 button[i].hidden = false;
28 button[i].onPress = () => {
29 Engine.PopGuiPage(i);
30 };
31
32 if (i == 0)
33 cancelHotkey.onPress = button[i].onPress;
34 });
35}
Note: See TracBrowser for help on using the repository browser.