mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 15:56:01 +00:00
Release controls when touch is cancelled
This commit is contained in:
1 parent
cec15326eb
commit
47321773ea
1 file changed
+7
-2
@@ -508,8 +508,13 @@ class OnScreenControls(context: Context, private val pad: PadBridge?, private va
|
|||||||
}
|
}
|
||||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_POINTER_UP, MotionEvent.ACTION_CANCEL -> {
|
MotionEvent.ACTION_UP, MotionEvent.ACTION_POINTER_UP, MotionEvent.ACTION_CANCEL -> {
|
||||||
val pointer = event.getPointerId(event.actionIndex)
|
val pointer = event.getPointerId(event.actionIndex)
|
||||||
if (quickPressedBy == pointer || event.actionMasked == MotionEvent.ACTION_CANCEL) {
|
if (event.actionMasked == MotionEvent.ACTION_CANCEL) {
|
||||||
val toggled = quickPressedBy == pointer && event.actionMasked == MotionEvent.ACTION_UP && quickContains(event.x, event.y)
|
quickPressedBy = -1
|
||||||
|
releaseAll()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (quickPressedBy == pointer) {
|
||||||
|
val toggled = event.actionMasked == MotionEvent.ACTION_UP && quickContains(event.x, event.y)
|
||||||
quickPressedBy = -1
|
quickPressedBy = -1
|
||||||
if (toggled) setQuickHidden(!quickHidden)
|
if (toggled) setQuickHidden(!quickHidden)
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in new issue
Block a user