Please I need help!!! I have problem with rotating and draging :cry: Like you see in the video When...
a
Please I need help!!! I have problem with rotating and draging 😢 Like you see in the video When I insert image and draging it without rotate it (it's works fine ) But if I rotate the image and try to drag it It drags to the wrong sens Which is not what it suppose to drag !!! Any one have an idea how to fix it ?!
1
c
I like this problem. Seems like your rotation is messing with the direction you are dragging. This Loks like some normalization case. I'll come back to this tomorrow, if you would like to write me, do so
❤️ 1
a
@Cicero Hello, I have a problem that I faild to solve in compose "Drag, Rotate and zomming" This is the code:
Copy code
Box(modifier = Modifier.fillMaxSize()) {
    var offsetX by remember { mutableStateOf(0f) }
    var offsetY by remember { mutableStateOf(0f) }

    var scale by remember { mutableStateOf(1f) }
    var rotation by remember { mutableStateOf(0f) }

    Box(

        Modifier
            .scale(scale)
            .rotate(rotation)
            .offset { IntOffset(offsetX.roundToInt(), offsetY.roundToInt()) }
            .height(50.dp)
            .width(200.dp)
            .pointerInput(Unit) {

                detectTransformGestures { centroid, pan, zoom, rot ->
                    offsetX += pan.x
                    offsetY += pan.y

                    scale *= zoom

                    rotation += rot

                }

            }

            .background(Color.Blue)

    )
}
 The problem is It's not rotate correctly And if switch the order like this: The dragging not working properly !!! Any help or explination please
Copy code
Modifier
.offset { IntOffset(offsetX.roundToInt(), offsetY.roundToInt()) }
            .height(50.dp)
            .width(200.dp)
            .scale(scale)
            .rotate(rotation)