mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-24 06:04:08 +00:00
Also check distance between clicks when detecting double click
This commit is contained in:
parent
c766b7e733
commit
50cc4f6630
1 changed files with 2 additions and 1 deletions
|
|
@ -112,7 +112,8 @@ class MouseEvents(deque[MouseEvent]):
|
|||
|
||||
def click_count(self, button: int = GLFW_MOUSE_BUTTON_LEFT) -> Literal[0, 1, 2]:
|
||||
if len(self) > 1 and self[-1].button == button and self[-1].is_click(self[-2]):
|
||||
if len(self) > 3 and self[-3].is_click(self[-4]) and self[-1].at - self[-4].at <= 2 * get_click_interval():
|
||||
if len(self) > 3 and self[-3].is_click(self[-4]) and \
|
||||
self[-1].at - self[-4].at <= 2 * get_click_interval() and self[-2].distance_squared(self[-3]) < 2:
|
||||
return 2
|
||||
return 1
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue