|
|
@ -8,16 +8,12 @@ package org.jetbrains.compose.web.skiko |
|
|
|
import androidx.compose.runtime.Composable |
|
|
|
import androidx.compose.runtime.Composable |
|
|
|
import androidx.compose.ui.window.ComposeCanvas |
|
|
|
import androidx.compose.ui.window.ComposeCanvas |
|
|
|
import org.jetbrains.compose.web.dom.ElementScope |
|
|
|
import org.jetbrains.compose.web.dom.ElementScope |
|
|
|
import org.jetbrains.skiko.wasm.onWasmReady |
|
|
|
|
|
|
|
import org.w3c.dom.HTMLCanvasElement |
|
|
|
import org.w3c.dom.HTMLCanvasElement |
|
|
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
fun ElementScope<HTMLCanvasElement>.skiko(block: @Composable () -> Unit) { |
|
|
|
fun ElementScope<HTMLCanvasElement>.skiko(block: @Composable () -> Unit) { |
|
|
|
// onWasmReady { |
|
|
|
|
|
|
|
DomSideEffect { canvas -> |
|
|
|
DomSideEffect { canvas -> |
|
|
|
ComposeCanvas(canvas).apply { |
|
|
|
val skikoCanvas = ComposeCanvas(canvas) |
|
|
|
setContent(block) |
|
|
|
skikoCanvas.setContent(block) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
} |