filter lefat and right gestures in GestureSurface as these are not used by interact with system UI

This commit is contained in:
Christian Schabesberger 2024-09-04 10:58:01 +02:00
parent 9c9d628f0c
commit 45043f1739
1 changed files with 7 additions and 1 deletions

View File

@ -37,6 +37,7 @@ import androidx.compose.ui.input.pointer.pointerInteropFilter
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.math.abs
private const val MULTITAB_MODE_DELAY: Long = 300
@ -115,9 +116,14 @@ fun GestureSurface(
val handleMove = { event: MotionEvent, lambda: (movement: TouchedPosition) -> Unit ->
val currentTouchedPosition = TouchedPosition(event.x, event.y)
val movement = currentTouchedPosition - lastTouchedPosition
lastTouchedPosition = currentTouchedPosition
moveOccured = true
// filter out left and right movements as these are not important for the app
if(abs(movement.x) <= abs(movement.y)) {
lambda(movement)
}
true
}