debug android scroll

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-08-10 14:48:00 +08:00
parent 5f7055e282
commit 072430cef5

View File

@ -176,23 +176,21 @@ class InputService : AccessibilityService() {
@RequiresApi(Build.VERSION_CODES.N) @RequiresApi(Build.VERSION_CODES.N)
fun onTouchInput(mask: Int, _x: Int, _y: Int) { fun onTouchInput(mask: Int, _x: Int, _y: Int) {
val x = max(0, _x)
val y = max(0, _y)
when (mask) { when (mask) {
TOUCH_PAN_UPDATE -> { TOUCH_PAN_UPDATE -> {
mouseX -= x * SCREEN_INFO.scale mouseX -= _x * SCREEN_INFO.scale
mouseY -= y * SCREEN_INFO.scale mouseY -= _y * SCREEN_INFO.scale
continueGesture(mouseX, mouseY) continueGesture(mouseX, mouseY)
} }
TOUCH_PAN_START -> { TOUCH_PAN_START -> {
mouseX = x * SCREEN_INFO.scale mouseX = max(0, _x) * SCREEN_INFO.scale
mouseY = y * SCREEN_INFO.scale mouseY = max(0, _y) * SCREEN_INFO.scale
startGesture(mouseX, mouseY) startGesture(mouseX, mouseY)
} }
TOUCH_PAN_END -> { TOUCH_PAN_END -> {
endGesture(mouseX, mouseY) endGesture(mouseX, mouseY)
mouseX = x * SCREEN_INFO.scale mouseX = max(0, _x) * SCREEN_INFO.scale
mouseY = y * SCREEN_INFO.scale mouseY = max(0, _y) * SCREEN_INFO.scale
} }
else -> {} else -> {}
} }