diff --git a/src/utilities/mouse.py b/src/utilities/mouse.py index 206d1bec..4b30959f 100644 --- a/src/utilities/mouse.py +++ b/src/utilities/mouse.py @@ -97,6 +97,19 @@ def click(self, button="left", force_delay=False, check_red_click=False) -> tupl pag.mouseUp(button=button) if check_red_click: return self.__is_red_click(mouse_pos_before, mouse_pos_after) + def double_click(self, force_delay=False): + """ + Double left-clicks on the current mouse position with a small delay between clicks. + Args: + with_delay: whether to add a random delay between each click (default True). This delay is on top of any additional delay in click() + """ + self.click(force_delay=force_delay) + if force_delay or self.click_delay: + LOWER_BOUND_WAIT_INTERVAL = 0.07 # Milliseconds + UPPER_BOUND_WAIT_INTERVAL = 0.15 # Milliseconds + AVERAGE_WAIT_INTERVAL = 0.09 # Milliseconds + time.sleep(truncated_normal_sample(LOWER_BOUND_WAIT_INTERVAL, UPPER_BOUND_WAIT_INTERVAL, AVERAGE_WAIT_INTERVAL)) + self.click(force_delay=force_delay) def right_click(self, force_delay=False): """