Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functions to toggle mouse drag and gaze scrolling on and off #1509

Merged
merged 5 commits into from
Sep 7, 2024
Merged
Changes from 4 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
14 changes: 14 additions & 0 deletions plugin/mouse/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ def mouse_drag_end():
for button in buttons_held_down:
ctrl.mouse_click(button=button, up=True)

def mouse_drag_toggle(button: int):
"""If the button is held down, release the button, else start dragging"""
if button in list(ctrl.mouse_buttons_down()):
ctrl.mouse_click(button=button, up=True)
else:
self.mouse_drag(button=button)
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved

def mouse_sleep():
"""Disables control mouse, zoom mouse, and re-enables cursor"""
actions.tracking.control_zoom_toggle(False)
Expand Down Expand Up @@ -221,6 +228,13 @@ def mouse_gaze_scroll():
actions.tracking.control_toggle(True)
control_mouse_forced = True

def mouse_gaze_scroll_toggle():
"""If not scrolling, start gaze scroll, else stop scrolling."""
if continuous_scroll_mode == "":
self.mouse_gaze_scroll()
AndreasArvidsson marked this conversation as resolved.
Show resolved Hide resolved
else:
self.mouse_scroll_stop()

def copy_mouse_position():
"""Copy the current mouse position coordinates"""
position = ctrl.mouse_pos()
Expand Down