Nikky

    Nikky

    5 months ago
    compose web draws into a canvas.. what javascript hooks would i need to adjust the canvas to the browser window size each time it gets resized ? i tried
    function resize_canvas(){
        canvas = document.getElementById("ComposeTarget");
        canvas.width  = window.innerWidth;
        canvas.height = window.innerHeight;
    }
    with
    <body onresize="resize_canvas()">
    and.. although that resizes the canvas.. it stops rendering
    hfhbd

    hfhbd

    5 months ago
    what do you mean by
    compose web draws into a canvas
    ? It does not by default with the current dom api.
    Nikky

    Nikky

    5 months ago
    at least the example i worked from used a canvas .. and when i try to use
    renderComposable(rootElementId = "root")
    it seems to throw for me.. so i used the canvas for a while i guess i will try to make DOm renderer work
    hfhbd

    hfhbd

    5 months ago
    Currently, compose does not support canvas and you have to use it by yourself. 🤔
    Nikky

    Nikky

    5 months ago
    Wonder where i got the sample from that uses skia to render composable on a canvas then
    hfhbd

    hfhbd

    5 months ago
    The MPP falling balls example uses the experimental canvas api. Currently, the Dom api is published and "stable". At the start, JB tried to convert the compose foundation to the web too, by using the html Dom api. This was called widget api and is deprecated. the new replacement is not available at the moment.
    Nikky

    Nikky

    5 months ago
    Yeah i am using that.. But the dom api seems broken in the alphas
    Making a desktop+web client seems hard right now with components that work on one but not the other..
    hfhbd

    hfhbd

    5 months ago
    Yeah, at the moment you can share your logic, but must use different UI apis