From eb59c63a603be1824983a499deb7dcfc1bad755b Mon Sep 17 00:00:00 2001 From: nickedyer Date: Mon, 20 Feb 2023 00:37:58 -0500 Subject: [PATCH] added color shift if dial is being moved --- thermopi/surfaces/dial.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/thermopi/surfaces/dial.py b/thermopi/surfaces/dial.py index 24de9fa..af5ec0b 100644 --- a/thermopi/surfaces/dial.py +++ b/thermopi/surfaces/dial.py @@ -11,6 +11,7 @@ class Dial(pygame.Surface): self.rect = self.get_rect() self.dial_size = dial_size self.center = (self.dial_size / 2, self.dial_size / 2) + self.moving = False self.setting = 1 @@ -18,7 +19,10 @@ class Dial(pygame.Surface): self.fill((0, 0, 0, 0)) pygame.draw.circle(self, (0, 255, 0), self.center, self.dial_size / 2, 5) - pygame.draw.circle(self, (64, 64, 64), self.center, self.dial_size / 2 * 0.95) + if self.moving: + pygame.draw.circle(self, (48, 48, 48), self.center, self.dial_size / 2 * 0.95) + else: + pygame.draw.circle(self, (64, 64, 64), self.center, self.dial_size / 2 * 0.95) angle = (1.25 - (1.5 * self.setting)) * math.pi x_1 = (math.cos(angle) * self.dial_size / 2 * 0.75) + (self.dial_size / 2) @@ -89,6 +93,9 @@ class Surface(pygame.Surface): if self.mouse_handler.active: self.dial.move_dial(self.mouse_handler.get_circular_speed(self.dial.center) / -3000.0) + self.dial.moving = True + else: + self.dial.moving = False self.blit(self.dial, self.dial.rect)