|
|
@ -14,9 +14,15 @@ import org.w3c.dom.HTMLCanvasElement |
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
fun ElementScope<HTMLCanvasElement>.skiko(block: @Composable () -> Unit) { |
|
|
|
fun ElementScope<HTMLCanvasElement>.skiko(block: @Composable () -> Unit) { |
|
|
|
DomSideEffect { canvas -> |
|
|
|
DomSideEffect { canvas -> |
|
|
|
|
|
|
|
var skikoCanvas: ComposeCanvas? = null |
|
|
|
|
|
|
|
|
|
|
|
onWasmReady { |
|
|
|
onWasmReady { |
|
|
|
val skikoCanvas = ComposeCanvas(canvas) |
|
|
|
skikoCanvas = ComposeCanvas(canvas) |
|
|
|
skikoCanvas.setContent(block) |
|
|
|
skikoCanvas?.setContent(block) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onDispose { |
|
|
|
|
|
|
|
skikoCanvas?.dispose() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |