summaryrefslogtreecommitdiffstats
path: root/scene/gui/check_button.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/check_button.cpp')
-rw-r--r--scene/gui/check_button.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index ca2ef220fd..29b9504776 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -57,20 +57,20 @@ Size2 CheckButton::get_icon_size() const {
Size2 tex_size = Size2(0, 0);
if (!on_tex.is_null()) {
- tex_size = Size2(on_tex->get_width(), on_tex->get_height());
+ tex_size = on_tex->get_size();
}
if (!off_tex.is_null()) {
- tex_size = Size2(MAX(tex_size.width, off_tex->get_width()), MAX(tex_size.height, off_tex->get_height()));
+ tex_size = tex_size.max(off_tex->get_size());
}
- return tex_size;
+ return _fit_icon_size(tex_size);
}
Size2 CheckButton::get_minimum_size() const {
Size2 minsize = Button::get_minimum_size();
const Size2 tex_size = get_icon_size();
if (tex_size.width > 0 || tex_size.height > 0) {
- const Size2 padding = _get_current_stylebox()->get_minimum_size();
+ const Size2 padding = _get_largest_stylebox_size();
Size2 content_size = minsize - padding;
if (content_size.width > 0 && tex_size.width > 0) {
content_size.width += MAX(0, theme_cache.h_separation);
@@ -134,9 +134,9 @@ void CheckButton::_notification(int p_what) {
ofs.y = (get_size().height - tex_size.height) / 2 + theme_cache.check_v_offset;
if (is_pressed()) {
- on_tex->draw(ci, ofs);
+ on_tex->draw_rect(ci, Rect2(ofs, _fit_icon_size(on_tex->get_size())));
} else {
- off_tex->draw(ci, ofs);
+ off_tex->draw_rect(ci, Rect2(ofs, _fit_icon_size(off_tex->get_size())));
}
} break;
}