mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-15 07:28:30 +00:00
Fix unreliable allow multiple votes toggle.
This commit is contained in:
committed by
jeffrey-signal
parent
3e54cc5c77
commit
e4ec538f13
@@ -21,6 +21,7 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.pointer.PointerInputChange
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.zIndex
|
||||
@@ -127,11 +128,13 @@ internal constructor(
|
||||
draggingItemInitialOffset = 0
|
||||
}
|
||||
|
||||
internal fun onDrag(offset: Offset) {
|
||||
internal fun onDrag(offset: Offset, change: PointerInputChange) {
|
||||
if ((includeHeader && draggingItemIndex == 0) ||
|
||||
(includeFooter && draggingItemIndex == (state.layoutInfo.totalItemsCount - 1))
|
||||
) return
|
||||
|
||||
change.consume()
|
||||
|
||||
draggingItemDraggedDelta += offset.y
|
||||
|
||||
val draggingItem = draggingItemLayoutInfo ?: return
|
||||
@@ -203,8 +206,7 @@ fun Modifier.dragContainer(
|
||||
return pointerInput(dragDropState) {
|
||||
detectDragGestures(
|
||||
onDrag = { change, offset ->
|
||||
change.consume()
|
||||
dragDropState.onDrag(offset = offset)
|
||||
dragDropState.onDrag(offset = offset, change = change)
|
||||
},
|
||||
onDragStart = { offset -> dragDropState.onDragStart(offset) },
|
||||
onDragEnd = { dragDropState.onDragEnd() },
|
||||
|
||||
Reference in New Issue
Block a user