diff --git a/ahk/_async/engine.py b/ahk/_async/engine.py index 0aa064d..b7dde23 100644 --- a/ahk/_async/engine.py +++ b/ahk/_async/engine.py @@ -2901,7 +2901,7 @@ async def mouse_drag( *, from_position: Optional[Tuple[int, int]] = None, speed: Optional[int] = None, - button: MouseButton = 1, + button: MouseButton = 'left', relative: Optional[bool] = None, blocking: bool = True, coord_mode: Optional[CoordModeRelativeTo] = None, @@ -2927,6 +2927,8 @@ async def mouse_drag( if coord_mode: args.append(coord_mode) + else: + args.append('') await self._transport.function_call('AHKMouseClickDrag', args, blocking=blocking) diff --git a/ahk/_constants.py b/ahk/_constants.py index 0686deb..4158936 100644 --- a/ahk/_constants.py +++ b/ahk/_constants.py @@ -4815,7 +4815,17 @@ CoordMode("Mouse", relative_to) } - MouseClickDrag(button, x1, y1, x2, y2, speed, relative) + if (speed = "") { + speed := A_DefaultMouseSpeed + } + + if (x1 = "" and y1 = "") { + MouseClickDrag(button, , , x2, y2, speed, relative) + } + else { + MouseClickDrag(button, x1, y1, x2, y2, speed, relative) + } + if (relative_to != "") { CoordMode("Mouse", current_coord_rel) diff --git a/ahk/_sync/engine.py b/ahk/_sync/engine.py index 57505a9..d383932 100644 --- a/ahk/_sync/engine.py +++ b/ahk/_sync/engine.py @@ -2889,7 +2889,7 @@ def mouse_drag( *, from_position: Optional[Tuple[int, int]] = None, speed: Optional[int] = None, - button: MouseButton = 1, + button: MouseButton = 'left', relative: Optional[bool] = None, blocking: bool = True, coord_mode: Optional[CoordModeRelativeTo] = None, @@ -2915,6 +2915,8 @@ def mouse_drag( if coord_mode: args.append(coord_mode) + else: + args.append('') self._transport.function_call('AHKMouseClickDrag', args, blocking=blocking) diff --git a/ahk/templates/daemon-v2.ahk b/ahk/templates/daemon-v2.ahk index 37d5915..2742a6f 100644 --- a/ahk/templates/daemon-v2.ahk +++ b/ahk/templates/daemon-v2.ahk @@ -1896,7 +1896,17 @@ AHKMouseClickDrag(args*) { CoordMode("Mouse", relative_to) } - MouseClickDrag(button, x1, y1, x2, y2, speed, relative) + if (speed = "") { + speed := A_DefaultMouseSpeed + } + + if (x1 = "" and y1 = "") { + MouseClickDrag(button, , , x2, y2, speed, relative) + } + else { + MouseClickDrag(button, x1, y1, x2, y2, speed, relative) + } + if (relative_to != "") { CoordMode("Mouse", current_coord_rel)