the focus of the knobs is removed, when the fx_mode is changed

This commit is contained in:
SallarShayegan
2025-02-28 14:21:06 +01:00
parent b960bcbd7f
commit 31ae63b594
3 changed files with 8 additions and 7 deletions

View File

@ -23,7 +23,6 @@ class Knob:
if focused:
self.focused = True
self.color = color_primary_light
self.group.deactivate_knobs_except(self)
else:
self.focused = False
self.color = color_primary
@ -32,7 +31,8 @@ class Knob:
return self.position
def __eq__(self, other):
return self.position == other.get_position()
if other is None: return False
return self.name == other.name
def get_pointer_position(self):
angle = (self.value * 0.8 * 2 + 0.7) * math.pi
@ -45,7 +45,7 @@ class Knob:
if m1:
pos = pygame.mouse.get_pos()
if math.sqrt(math.pow(pos[0]-self.position[0],2) + math.pow(pos[1]-self.position[1],2)) < self.radius:
self.set_focused(True)
self.group.set_focused(self)
pygame.draw.circle(screen, self.color, self.position, self.radius)
pygame.draw.line(screen, "black", self.position, self.get_pointer_position(), 4)