From b0b1da69505fe4d9fa3af3e232ffff726f6c055e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 2 Jan 2016 15:51:41 -0300 Subject: Make buttons properly obey stylebox content marins, closes #2156 --- scene/gui/button.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scene') diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 59f2f34b82..b9ce46d738 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -137,8 +137,10 @@ void Button::_notification(int p_what) { text_ofs.y+=font->get_ascent(); font->draw( ci, text_ofs.floor(), text, color,clip_text?text_clip:-1); if (!_icon.is_null()) { + + int valign = size.height-style->get_minimum_size().y; - _icon->draw(ci,Point2(style->get_offset().x, Math::floor( (size.height-_icon->get_height())/2.0 ) ),is_disabled()?Color(1,1,1,0.4):Color(1,1,1) ); + _icon->draw(ci,style->get_offset()+Point2(0, Math::floor( (valign-_icon->get_height())/2.0 ) ),is_disabled()?Color(1,1,1,0.4):Color(1,1,1) ); } -- cgit v1.2.3