I am using a draggable content in which I want the image or the box in below code to stick within the boundaries of the box composable while dragging not move out to the parent Column composable as shown in the image below how to achieve it
@Composable
private fun
DraggableTextLowLevel() {
Column(Modifier.fillMaxSize()). {
Text("Custom Edit Place")
Box(modifier = Modifier.hieght(200.dp).width(300.dp) {
var offsetX by remember { mutableStateOf(0f) }
var offsetY by remember { mutableStateOf(0f) }
Box(
Modifier
.offset { IntOffset(offsetX.roundToInt(), offsetY.roundToInt()) }
.background(Color.Blue)
.size(50.dp)
.pointerInput(Unit) {
detectDragGestures { change, dragAmount ->
change.consume()
offsetX += dragAmount.x
offsetY += dragAmount.y
}
}
)
}
}
}