Rafs
01/08/2021, 9:25 PMModifier
.offset(x = { offset.x }, y = { offset.y })
has been removed from alpha09
Luke
01/08/2021, 9:51 PMPlease use offset with lambda parameters insteadbut it's not in the library
Rafs
01/08/2021, 9:58 PMAdam Powell
01/08/2021, 10:02 PMModifier.offset { IntOffset(...) }
Adam Powell
01/08/2021, 10:02 PMreplaceWith
on the old method was staleRafs
01/08/2021, 10:39 PMvar boxPosition by remember { mutableStateOf(Offset.Zero) }
Box(
modifier = Modifier
.fillMaxSize()
) {
Box(
modifier = Modifier
.dragGestureFilter(dragObserver = object : DragObserver {
override fun onDrag(dragDistance: Offset): Offset {
boxPosition += dragDistance
return dragDistance
}
})
.offset {
IntOffset(boxPosition.x.toInt(), boxPosition.y.toInt())
}
.background(color = Color.Black)
.preferredSize(100.dp)
)
}
Thx. In this code snippet, the drag observer rarely get's called. It was working fine on alpha08 @Adam PowellAdam Powell
01/08/2021, 10:42 PM