From f1a433e747a03bb9b58842044e65e2ba83cf0c63 Mon Sep 17 00:00:00 2001 From: Dan Lawrence Date: Sun, 28 Jan 2024 20:59:14 +0000 Subject: [PATCH] fix double click event bug --- pygame_gui/elements/ui_button.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pygame_gui/elements/ui_button.py b/pygame_gui/elements/ui_button.py index 1ef8e413..09bd78cd 100644 --- a/pygame_gui/elements/ui_button.py +++ b/pygame_gui/elements/ui_button.py @@ -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 @@ -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, @@ -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))