# compose


11/26/2020, 1:09 PM
I have - what I think - a rather complicated use case for a Drag and Drop. But now, here is the "placeholder" where I want to do it :
Copy code
fun DragAndDropLayer(
    size: Dp,
) {
    /* Not needed for now
    val cellsSize = size / 9.0f
    var dragAndDropState: DragAndDropState? by remember { mutableStateOf(null) }
        modifier = Modifier
                color = Color.Transparent
    ) {

`````` What I would like to do is : 1. When no Drag And Drop is in place : the component remains empty, without any child 2. When Drag and Drop is started, the cursor is a custom image 3. When Drag and Drop is stopped, the component is empty again, without any child.
Is there a simple way to achive this ? I thought about handling click on the Column in order to show/hide the cursor, but that is not very pratical.
I am wondering this because i can't set up the drag listener directly on the Column composable, nor on the child cursor image, which is invisible between all Drag and Drops
Ok, it seems that's not possible. So I'll solve my main issue in another way. In fact, I had a static chess board layer, and a dynamic Drag and drop layer above. But I'm just going to use a boolean in the static layer for the user to choose if the pieces can be dragged.


11/26/2020, 2:39 PM
It should be possible, as I tried to implement the same before. I didn’t continue as I found it difficult to animate the composable, however.
👍 1