Skip to content

Commit 2ffb9ae

Browse files
committed
fix(input): scroll messages overlap on the injector so a wheel burst stays one drag (#1019)
1 parent e2082f3 commit 2ffb9ae

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎vendor/screen-capture/Sources/simlock-screen-capture/InputMode.swift‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,15 @@ func runInput(udid: String) async -> Never {
7878
case tagScroll:
7979
guard let dx = fields["dx"] as? Double, let dy = fields["dy"] as? Double else { continue }
8080
// The injector takes pixel deltas; the daemon sends fractions of the screen.
81-
await injector.sendScroll(
82-
dx: dx * Double(size.width), dy: dy * Double(size.height),
83-
anchorX: fields["x"] as? Double, anchorY: fields["y"] as? Double,
84-
screenWidth: size.width, screenHeight: size.height)
81+
// why: sendScroll sleeps to end the drag after the wheel idles; awaiting it would
82+
// make every message its own drag and hold stdin, so calls overlap on the actor.
83+
let anchorX = fields["x"] as? Double, anchorY = fields["y"] as? Double
84+
Task {
85+
await injector.sendScroll(
86+
dx: dx * Double(size.width), dy: dy * Double(size.height),
87+
anchorX: anchorX, anchorY: anchorY,
88+
screenWidth: size.width, screenHeight: size.height)
89+
}
8590
default:
8691
continue
8792
}

0 commit comments

Comments
 (0)