From 64830eee12f91829f3f7b6730201fe4d1dead09c Mon Sep 17 00:00:00 2001 From: alvroble <50918598+alvroble@users.noreply.github.com> Date: Sat, 9 Nov 2024 10:48:47 +0100 Subject: [PATCH] Bug fix: center icon --- src/seedsigner/gui/toast.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/seedsigner/gui/toast.py b/src/seedsigner/gui/toast.py index c1b64dc6..b5ff4391 100644 --- a/src/seedsigner/gui/toast.py +++ b/src/seedsigner/gui/toast.py @@ -31,8 +31,6 @@ class ToastOverlay(BaseComponent): icon_color=self.color ) icon_delta_x = self.icon.width + self.icon.screen_x - self.icon.screen_y = self.canvas_height - self.height + int((self.height - self.icon.height)/2) - self.label = TextArea( image_draw=self.image_draw, @@ -52,9 +50,12 @@ class ToastOverlay(BaseComponent): if self.label.height > GUIConstants.ICON_FONT_SIZE: self.height = self.label.height + GUIConstants.EDGE_PADDING * 2 - # Vertically center the message within the toast (for single- or multi-line + # Vertically center the message and icon within the toast (for single- or multi-line # messages). self.label.screen_y = self.canvas_height - self.height + self.outline_thickness + int((self.height - 2*self.outline_thickness - self.label.height)/2) + + if self.icon_name: + self.icon.screen_y = self.canvas_height - self.height + int((self.height - self.icon.height)/2) def render(self):