diff --git a/data/gui/screens/addons_screen.stkgui b/data/gui/screens/addons_screen.stkgui index 1f38fcc74..c033a1e4e 100644 --- a/data/gui/screens/addons_screen.stkgui +++ b/data/gui/screens/addons_screen.stkgui @@ -1,9 +1,9 @@
- - - + + +
diff --git a/data/gui/screens/ghost_replay_selection.stkgui b/data/gui/screens/ghost_replay_selection.stkgui index a904479fa..18fbae184 100644 --- a/data/gui/screens/ghost_replay_selection.stkgui +++ b/data/gui/screens/ghost_replay_selection.stkgui @@ -1,9 +1,9 @@
- - - + + +
diff --git a/data/gui/screens/online/server_selection.stkgui b/data/gui/screens/online/server_selection.stkgui index 82113b35e..fabc40c32 100644 --- a/data/gui/screens/online/server_selection.stkgui +++ b/data/gui/screens/online/server_selection.stkgui @@ -1,9 +1,9 @@
- - - + + +
diff --git a/src/guiengine/screen_loader.cpp b/src/guiengine/screen_loader.cpp index c477b8d8b..6a0fc3c2f 100644 --- a/src/guiengine/screen_loader.cpp +++ b/src/guiengine/screen_loader.cpp @@ -213,6 +213,7 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = core::stringc(prop_name). READ_PROPERTY(layout, PROP_LAYOUT); READ_PROPERTY(align, PROP_ALIGN); READ_PROPERTY(custom_ratio, PROP_CUSTOM_RATIO); + READ_PROPERTY(icon_align, PROP_ICON_ALIGN); READ_PROPERTY(icon, PROP_ICON); READ_PROPERTY(focus_icon, PROP_FOCUS_ICON); diff --git a/src/guiengine/widget.hpp b/src/guiengine/widget.hpp index 41ee228b7..dc4fb3ecd 100644 --- a/src/guiengine/widget.hpp +++ b/src/guiengine/widget.hpp @@ -114,6 +114,7 @@ namespace GUIEngine PROP_DIV_PADDING, PROP_KEEP_SELECTION, PROP_CUSTOM_RATIO, + PROP_ICON_ALIGN, }; bool isWithinATextBox(); diff --git a/src/guiengine/widgets/icon_button_widget.cpp b/src/guiengine/widgets/icon_button_widget.cpp index 576b997d7..73a1f87db 100644 --- a/src/guiengine/widgets/icon_button_widget.cpp +++ b/src/guiengine/widgets/icon_button_widget.cpp @@ -146,15 +146,14 @@ void IconButtonWidget::add() suggested_h = (int)(suggested_h*needed_scale_factor); } - // This is a bit messy, because m_x gives position of left side of an image, - // but in most cases we need to scale it based on center of the image, so - // this is the default action here. - // There are some cases when it causes issues though, for example when we - // explicitly want particular widget position or left/right align. So let's - // just use left/right align in this case. - bool left_horizontal = m_properties[PROP_X].size() > 0 || - m_properties[PROP_ALIGN] == "left"; - bool right_horizontal = m_properties[PROP_ALIGN] == "right"; + bool left_horizontal = m_properties[PROP_ICON_ALIGN] == "left"; + bool right_horizontal = m_properties[PROP_ICON_ALIGN] == "right"; + + // Assume left align if align property is not specified, but x property is specified + if (m_properties[PROP_X].size() > 0 && m_properties[PROP_ICON_ALIGN].empty()) + { + left_horizontal = true; + } const int x_from = right_horizontal ? m_x + (m_w - suggested_w) : left_horizontal ? m_x :