Stefan Oltmann
01/17/2024, 5:04 PMBox {
Box(
modifier = Modifier
.border(1.dp, Color.Blue)
.size(
width = 200.dp,
height = 200.dp
)
.graphicsLayer(
translationX = 50,
translationY = 50
)
)
}
Stefan Oltmann
01/17/2024, 5:09 PMCanvas(
modifier = Modifier
) {
for (face in faces) {
drawRect(
color = Color.Red,
topLeft = Offset(
x = it.size.width * face.xPos.toFloat(),
y = it.size.height * face.yPos.toFloat()
),
size = Size(
width = it.size.width * face.width.toFloat(),
height = it.size.height * face.height.toFloat()
),
style = Stroke()
)
}
}
romainguy
01/17/2024, 5:10 PMBox
.Stefan Oltmann
01/17/2024, 5:11 PMStefan Oltmann
01/17/2024, 5:14 PMromainguy
01/17/2024, 5:16 PMgraphicsLayer()
didn’t work, although I would recommend against it for this use case)romainguy
01/17/2024, 5:16 PMCanvas
+ pointerInput
modifier is all you need really.romainguy
01/17/2024, 5:18 PMoffset()
doesn’t work, but maybe that’s a Box
specific thing (I’ve used it in Column
)Stefan Oltmann
01/17/2024, 5:20 PMDan MacNeil
01/17/2024, 5:56 PMgraphicsLayer
or offset
to be the first modifier
then the position will move. I only tested this on Android platform.Stefan Oltmann
01/17/2024, 5:58 PMStefan Oltmann
01/17/2024, 5:58 PM