Is it possible to integrate compose HTML and compose canvas composables together?
m
mohamed rejeb
03/30/2024, 5:50 AM
Yes, it's possible, create a canvas inside Compose HTML and then in Compose Canvas target that canvas id and you will have both in the same app. You can also share states between the two.
Copy code
fun main() {
val viewmodel = remember { ViewModel() }
// compose html code here
// canvas with id "canvasId"
// compose canvas code here
onWasmReady {
CanvasBasedWindow(
title = "Title",
canvasElementId = "canvasId",
) {
}
}
}
s
spierce7
04/01/2024, 12:23 PM
Can you position compose html elements inside of or on top of compose html in the same layout hierarchy or do you have to maintain 2 separate layouts entirely?