ste
11/05/2022, 7:16 AMdetectVerticalDragGestures
and detectHorizontalDragGestures
overlap (i.e. they belong to different composables, but share the same touch source), how I can dispatch events to detectHorizontalDragGestures
only when the drag is very horizontal? When scrolling with our thumb, vertical swipes tend to be detected as horizontal ones
(images in thread)ste
11/05/2022, 7:37 AMste
11/15/2022, 8:21 PMste
11/15/2022, 8:21 PMandrew
11/15/2022, 8:52 PMste
11/16/2022, 12:15 PMfraction
is the tangent of the alpha angle. full code: gistandrew
11/16/2022, 4:20 PMJan
11/17/2022, 12:43 PMimport androidx.compose.foundation.gestures.HorizontalPointerDirectionConfig
import androidx.compose.foundation.gestures.PointerDirectionConfig
import androidx.compose.foundation.gestures.pointerSlop
import androidx.compose.ui.util.fastFirstOrNull
is it because of a different compose version?
i’m on 1.3.0ste
11/17/2022, 12:54 PM@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
? Also, for`fastFirstOrNull` you need androidx.compose.ui:ui-util
Jan
11/19/2022, 5:00 PMste
11/19/2022, 5:36 PMModifier.scrollable
, which uses a different logic to handle gestures.Jan
11/19/2022, 6:13 PMste
11/19/2022, 6:24 PMBox(
modifier = Modifier
.pointerInput(Unit) {
detectHorizontalDragGestures(...)
}
) {
Row(
modifier = Modifier
.horizontalScrollable(...)
) {
// ...
}
}
Horizontal scroll are sometimes handled by Row
, but some other times by Box
. So yeah, a piece of code is definitely missing... It works fine with detectVerticalDragGestures
and detectHorizontalDragGestures
, thought.ste
11/19/2022, 6:44 PM