Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/utilities/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down