tutorial guide: use full width for text when not showing buttons (related to #1612)

A little rant about why I 'hardcoded' the value 2.9em:
If you are using constants to specify some positions, please give the meaningful names so that other people can work with them. E.g. calling something "menu_height" and then using it to adjust the X position AND the Y position of a BUTTON probably means it's not the "menu_height"...
I believe that the current "dynamic layout" will terribly break if someone would e.g. decide that the menu should be one line higher (because hey, then everything else would also move).

The real solution is to rewrite the layout of the menu to be dynamic and use constants (because currently it isn't and doesn't, it just tries to.).
objectmenu
David Dormagen 2016-01-19 20:39:39 +01:00
parent 91e7da6fbd
commit a7b674f662
1 changed files with 11 additions and 2 deletions

View File

@ -146,7 +146,7 @@ private func InitializeMenu()
var prop_text =
{
Left = Format("0%%%s", ToEmString(10 * menu_height + text_margin)),
Right = Format("100%%%s", ToEmString(- 5 * menu_height - text_margin)),
// 'Right' will be set on update
Target = this,
ID = 2,
Text = nil,
@ -219,7 +219,16 @@ private func UpdateGuideMenu(string guide_message, bool has_next, bool has_prev,
{
// Update the text message entry.
prop_menu.text.Text = guide_message;
GuiUpdateText(guide_message, id_menu, prop_menu.text.ID, this);
// Don't usually leave a margin for the text - just when actually showing buttons.
var is_showing_buttons = has_next || has_close || has_prev;
var text_right_side = "100%";
if (is_showing_buttons)
{
text_right_side = Format("100%-2.9em");
}
GuiUpdate({Right = text_right_side, Text = guide_message}, id_menu, prop_menu.text.ID, this);
// Update the next/close button.
if (has_next || has_close)