From 30ba988ee6e8487dba93c7e47e2735cc14ba5a48 Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Fri, 5 May 2023 23:09:22 +0200 Subject: [PATCH] UI: Fix background size for widgets with padding --- arcade/gui/widgets/buttons.py | 2 +- arcade/gui/widgets/image.py | 4 ++-- arcade/gui/widgets/toggle.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arcade/gui/widgets/buttons.py b/arcade/gui/widgets/buttons.py index 4867eb5af..22453596f 100644 --- a/arcade/gui/widgets/buttons.py +++ b/arcade/gui/widgets/buttons.py @@ -190,7 +190,7 @@ def do_render(self, surface: Surface): current_state = self.get_current_state() current_texture = self._textures.get(current_state) if current_texture: - surface.draw_texture(0, 0, self.width, self.height, current_texture) + surface.draw_texture(0, 0, self.content_width, self.content_height, current_texture) def apply_style(self, style: UIStyle): """ diff --git a/arcade/gui/widgets/image.py b/arcade/gui/widgets/image.py index cd0db3aa3..fc26df722 100644 --- a/arcade/gui/widgets/image.py +++ b/arcade/gui/widgets/image.py @@ -30,7 +30,7 @@ def do_render(self, surface: Surface): surface.draw_texture( x=0, y=0, - width=self.width, - height=self.height, + width=self.content_width, + height=self.content_height, tex=self.texture ) diff --git a/arcade/gui/widgets/toggle.py b/arcade/gui/widgets/toggle.py index c4c90f9ba..331351da3 100644 --- a/arcade/gui/widgets/toggle.py +++ b/arcade/gui/widgets/toggle.py @@ -90,7 +90,7 @@ def do_render(self, surface: Surface): tex = self.pressed_on_tex if self.value else self.pressed_off_tex elif self.hovered: tex = self.hover_on_tex if self.value else self.hover_off_tex - surface.draw_texture(0, 0, self.width, self.height, tex) + surface.draw_texture(0, 0, self.content_width, self.content_height, tex) def on_change(self, event: UIOnChangeEvent): pass