filter lefat and right gestures in GestureSurface as these are not used by interact with system UI
This commit is contained in:
parent
9c9d628f0c
commit
45043f1739
|
@ -37,6 +37,7 @@ import androidx.compose.ui.input.pointer.pointerInteropFilter
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlin.math.abs
|
||||||
|
|
||||||
private const val MULTITAB_MODE_DELAY: Long = 300
|
private const val MULTITAB_MODE_DELAY: Long = 300
|
||||||
|
|
||||||
|
@ -115,9 +116,14 @@ fun GestureSurface(
|
||||||
val handleMove = { event: MotionEvent, lambda: (movement: TouchedPosition) -> Unit ->
|
val handleMove = { event: MotionEvent, lambda: (movement: TouchedPosition) -> Unit ->
|
||||||
val currentTouchedPosition = TouchedPosition(event.x, event.y)
|
val currentTouchedPosition = TouchedPosition(event.x, event.y)
|
||||||
val movement = currentTouchedPosition - lastTouchedPosition
|
val movement = currentTouchedPosition - lastTouchedPosition
|
||||||
|
|
||||||
lastTouchedPosition = currentTouchedPosition
|
lastTouchedPosition = currentTouchedPosition
|
||||||
moveOccured = true
|
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)
|
lambda(movement)
|
||||||
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue