diff --git a/src/ui/button.cpp b/src/ui/button.cpp index 7ee5be9..6b8091a 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -63,6 +63,7 @@ bool Button::handle_mouse_button_event(const MouseButtonEvent& e) { Button& Button::set_scale(float scale) { m_scale = scale; update_text_scale(); + update_border(); return *this; } diff --git a/src/ui/chat_box.cpp b/src/ui/chat_box.cpp index c342644..c409799 100644 --- a/src/ui/chat_box.cpp +++ b/src/ui/chat_box.cpp @@ -37,7 +37,7 @@ ChatBox& ChatBox::set_scale(float scale) { if (m_text_field) { m_text_field->set_scale(scale); } - + update_border(); return *this; } ChatBox& ChatBox::set_text_scale(float scale) { diff --git a/src/ui/image.cpp b/src/ui/image.cpp index d316523..d65a3eb 100644 --- a/src/ui/image.cpp +++ b/src/ui/image.cpp @@ -46,6 +46,7 @@ Image& Image::set_texture(const Texture* texture, bool change_size) { Image& Image::set_scale(float scale) { m_scale = scale; + update_border(); return *this; } float Image::scale() const { return m_scale; } @@ -68,7 +69,7 @@ float Image::width() const { if (m_fill_parent || m_fill_width) { return Widget::width(); } - return Widget::height() * m_scale; + return Widget::width() * m_scale; } const Texture* Image::texture() const { return m_texture; } diff --git a/src/ui/label.cpp b/src/ui/label.cpp index 7eba998..6fefd37 100644 --- a/src/ui/label.cpp +++ b/src/ui/label.cpp @@ -15,6 +15,7 @@ Label& Label::set_color(Color color) { } Label& Label::set_scale(float scale) { m_scale = scale; + update_border(); return *this; } diff --git a/src/ui/text_field.cpp b/src/ui/text_field.cpp index 6b01558..eefe2aa 100644 --- a/src/ui/text_field.cpp +++ b/src/ui/text_field.cpp @@ -107,7 +107,7 @@ void TextField::update_input_area() { TextField& TextField::set_scale(float scale) { m_scale = scale; m_cursor->set_height(std::max(1.0f, height() - DELTA_CUROUR_HEIGHT)); - + update_border(); return *this; } diff --git a/src/ui/widget.cpp b/src/ui/widget.cpp index e588818..ea26055 100644 --- a/src/ui/widget.cpp +++ b/src/ui/widget.cpp @@ -121,6 +121,9 @@ void Widget::set_width_internal(float width) { m_width = width; } void Widget::set_height_internal(float height) { m_height = height; } void Widget::update_border() { + if (!supports_border()) { + return; + } auto w = width(); auto h = height(); for (int i = 0; i < 4; ++i) {