Skip to content

Commit ec64639

Browse files
authored
UI: Fix background size for widgets with padding (#1753)
1 parent 37ba31f commit ec64639

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

arcade/gui/widgets/buttons.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def do_render(self, surface: Surface):
190190
current_state = self.get_current_state()
191191
current_texture = self._textures.get(current_state)
192192
if current_texture:
193-
surface.draw_texture(0, 0, self.width, self.height, current_texture)
193+
surface.draw_texture(0, 0, self.content_width, self.content_height, current_texture)
194194

195195
def apply_style(self, style: UIStyle):
196196
"""

arcade/gui/widgets/image.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def do_render(self, surface: Surface):
3030
surface.draw_texture(
3131
x=0,
3232
y=0,
33-
width=self.width,
34-
height=self.height,
33+
width=self.content_width,
34+
height=self.content_height,
3535
tex=self.texture
3636
)

arcade/gui/widgets/toggle.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def do_render(self, surface: Surface):
9090
tex = self.pressed_on_tex if self.value else self.pressed_off_tex
9191
elif self.hovered:
9292
tex = self.hover_on_tex if self.value else self.hover_off_tex
93-
surface.draw_texture(0, 0, self.width, self.height, tex)
93+
surface.draw_texture(0, 0, self.content_width, self.content_height, tex)
9494

9595
def on_change(self, event: UIOnChangeEvent):
9696
pass

0 commit comments

Comments
 (0)