Arjan van Wieringen
04/27/2023, 5:35 PMonDrag
modifier.Alexander Maryanovsky
04/27/2023, 5:48 PMdewildte
04/27/2023, 9:35 PMArjan van Wieringen
04/28/2023, 5:57 AMArjan van Wieringen
04/28/2023, 7:39 AMdemos/flow
. Please mind that it is part of a larger repository, so it is a big repo with plugins and whatnot... However, the jest should be clear. I simplified the example. As you can see in the movie I show some console logging. It happens in the onDrag
modifier.Arjan van Wieringen
04/28/2023, 7:45 AMAlexander Maryanovsky
04/28/2023, 8:02 AMArjan van Wieringen
04/28/2023, 8:35 AMArjan van Wieringen
04/28/2023, 11:40 AMMain.kt
My environment:
JVM: Coretto 17 aarm64 (but tried different ones)
Mac M1 Air
Kotlin 1.8.20
Compose 1.3.0Alexander Maryanovsky
04/28/2023, 11:42 AMArjan van Wieringen
04/28/2023, 11:43 AMArjan van Wieringen
04/28/2023, 11:43 AMArjan van Wieringen
04/28/2023, 11:44 AMAlexander Maryanovsky
04/28/2023, 11:48 AMAlexander Maryanovsky
04/28/2023, 12:53 PMArjan van Wieringen
04/28/2023, 1:03 PMAlexander Maryanovsky
04/28/2023, 1:19 PMAlexander Maryanovsky
04/28/2023, 1:20 PMdata class NoSlopViewConfiguration(
override val longPressTimeoutMillis: Long,
override val doubleTapTimeoutMillis: Long,
override val doubleTapMinTimeMillis: Long,
override val touchSlop: Float,
): ViewConfiguration
fun noSlopViewConfiguration(viewConfiguration: ViewConfiguration) = NoSlopViewConfiguration(
longPressTimeoutMillis = viewConfiguration.longPressTimeoutMillis,
doubleTapTimeoutMillis = viewConfiguration.doubleTapTimeoutMillis,
doubleTapMinTimeMillis = viewConfiguration.doubleTapMinTimeMillis,
touchSlop = 0f
)
@OptIn(ExperimentalFoundationApi::class)
@Composable fun Entity(
state: Entity,
onDragStart: () -> Unit = {},
onDrag: (DpOffset) -> Unit = {},
onDragEnd: () -> Unit = {}
) {
with(LocalDensity.current) {
val viewConfig = LocalViewConfiguration.current
CompositionLocalProvider(LocalViewConfiguration provides noSlopViewConfiguration(viewConfig)){
...
}
}
}