Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 51cdfbd1 authored by Simon Chan's avatar Simon Chan
Browse files

fix(scrcpy): fix scroll controller v1.15 changed in previous commit

parent 81f39bf5
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -36,17 +36,21 @@ export class ScrollController implements ScrcpyScrollController {
    ): ScrcpyInjectScrollControlMessage | undefined {
        // Ref https://github.com/libsdl-org/SDL/blob/878ea48b607f23e4ec8c12d1395b86ab529e30d0/src/events/SDL_mouse.c#L897-L914

        if (message.scrollX) {
            if (Math.sign(message.scrollX) !== Math.sign(this.#accumulatedX)) {
                this.#accumulatedX = message.scrollX;
            } else {
                this.#accumulatedX += message.scrollX;
            }
        }

        if (message.scrollY) {
            if (Math.sign(message.scrollY) !== Math.sign(this.#accumulatedY)) {
                this.#accumulatedY = message.scrollY;
            } else {
                this.#accumulatedY += message.scrollY;
            }
        }

        const integerX = this.#accumulatedX | 0;
        this.#accumulatedX -= integerX;