mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-04 10:19:17 +02:00
refactor(scrcpy): small optimizations
This commit is contained in:
parent
6b23154694
commit
b5f58227fd
11 changed files with 359 additions and 71 deletions
|
@ -5,16 +5,21 @@ import {
|
|||
import { ScrcpyControlMessageType } from "./type.js";
|
||||
|
||||
/**
|
||||
* On Android, touching the screen with a finger will disable mouse cursor.
|
||||
* However, Scrcpy doesn't do that, and can inject two pointers at the same time.
|
||||
* This can cause finger events to be "ignored" because mouse is still the primary pointer.
|
||||
* On both Android and Windows, while both mouse and touch are supported input devices,
|
||||
* only one of them can be active at a time. Touch the screen with a finger will deactivate mouse,
|
||||
* and move the mouse will deactivate touch.
|
||||
*
|
||||
* This helper class injects an extra `ACTION_UP` event,
|
||||
* On Android, this is achieved by dispatching a `MotionEvent.ACTION_UP` event for the previous input type.
|
||||
* But on Chrome, there is no such event, causing both mouse and touch to be active at the same time.
|
||||
* This can cause the new input to appear as "ignored".
|
||||
*
|
||||
* This helper class synthesis `ACTION_UP` events when a different pointer type appears,
|
||||
* so Scrcpy server can remove the previously hovering pointer.
|
||||
*/
|
||||
export class ScrcpyHoverHelper {
|
||||
// AFAIK, only mouse and pen can have hover state
|
||||
// and you can't have two mouses or pens.
|
||||
// So remember the last hovering pointer is enough.
|
||||
private lastHoverMessage: ScrcpyInjectTouchControlMessage | undefined;
|
||||
|
||||
public process(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue