Timestamp:
Oct 17, 2021, 12:58:51 PM (3 years ago)
Author:
Silier
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/mod/gui/msgbox/msgbox.js

    r22676 r25966  
    2525    let captions = data.buttonCaptions || [translate("OK")];
    2626
    27     // Set button captions and visibility
    2827    let mbButton = [];
    29     captions.forEach((caption, i) => {
    30         mbButton[i] = Engine.GetGUIObjectByName("mbButton" + (i + 1));
    31         mbButton[i].caption = caption;
    32         mbButton[i].hidden = false;
    33         mbButton[i].onPress = () => {
    34             Engine.PopGuiPage(i);
    35         };
    36 
    37         // Convention: Cancel is the first button
    38         if (i == 0)
    39             mbCancelHotkey.onPress = mbButton[i].onPress;
    40     });
    41 
    42     // Distribute buttons horizontally
    43     let y1 = "100%-46";
    44     let y2 = "100%-18";
    45     switch (captions.length)
    46     {
    47     case 1:
    48         mbButton[0].size = "18 " + y1 + " 100%-18 " + y2;
    49         break;
    50     case 2:
    51         mbButton[0].size = "18 " + y1 + " 50%-5 " + y2;
    52         mbButton[1].size = "50%+5 " + y1 + " 100%-18 " + y2;
    53         break;
    54     case 3:
    55         mbButton[0].size = "18 " + y1 + " 33%-5 " + y2;
    56         mbButton[1].size = "33%+5 " + y1 + " 66%-5 " + y2;
    57         mbButton[2].size = "66%+5 " + y1 + " 100%-18 " + y2;
    58         break;
    59     }
     28    setButtonCaptionsAndVisibitily(mbButton, captions, mbCancelHotkey, "mbButton");
     29    distributeButtonsHorizontally(mbButton, captions);
    6030}
Note: See TracChangeset for help on using the changeset viewer.