Skip to content

Commit

Permalink
fix double click event bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MyreMylar committed Jan 28, 2024
1 parent 273bf18 commit f1a433e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pygame_gui/elements/ui_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def process_event(self, event: pygame.event.Event) -> bool:
if self.is_enabled:
if (self.allow_double_clicks and self.last_click_button == event.button and
self.double_click_timer <= self.ui_manager.get_double_click_time()):
self.on_double_clicked()
self.on_double_clicked(event.button)
else:
self.on_start_press(event.button)
self.double_click_timer = 0.0
Expand Down Expand Up @@ -370,7 +370,7 @@ def on_pressed(self, button: int):
'mouse_button': button}
pygame.event.post(pygame.event.Event(UI_BUTTON_PRESSED, event_data))

def on_double_clicked(self):
def on_double_clicked(self, button: int):
# old event to remove in 0.8.0
event_data = {'user_type': OldType(UI_BUTTON_DOUBLE_CLICKED),
'ui_element': self,
Expand All @@ -380,7 +380,7 @@ def on_double_clicked(self):
# new event
event_data = {'ui_element': self,
'ui_object_id': self.most_specific_combined_id,
'mouse_button': event.button}
'mouse_button': button}
pygame.event.post(pygame.event.Event(UI_BUTTON_DOUBLE_CLICKED, event_data))


Expand Down

0 comments on commit f1a433e

Please sign in to comment.