dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Canvas API support?

Open planet0104 opened this issue 3 years ago • 2 comments

Any examples of using the canvas to draw graphics?

planet0104 avatar Jan 06 '22 06:01 planet0104

Only the Dioxus web can access the canvas directly, unfortunately. We might be able to build a shim over the canvas through RPC/FFI, or a declarative renderer for Dioxus that understands canvas (like React-Three-Fiber), but currently you can't get an imperative handle to the canvas.

jkelleyrtp avatar Jan 06 '22 18:01 jkelleyrtp

Does this mean in WASM I cannot get a handle to the canvas to draw to it from rust?

I looked at the bevy plugin example, it would be really great to have an approach that allowed us to get a drawing surface. (Canvases for web, drawing surfaces for window). I can see this app working extremely well as a UI.

Might be worth investigating more to see how easy it would be to have this lib use a window which is passed to it same as own rendering.

Zageron avatar Apr 08 '22 22:04 Zageron

@jkelleyrtp is there any update on this or why has the issue been closed? I'd need to be able to use the canvas for a project, that I'm currently planning

John0x avatar Jan 04 '23 22:01 John0x

I think other Rust web frameworks don't support access to the canvas either.

What I've seen is that projects select the canvas and draw on it via web-sys directly.

kud1ing avatar Feb 16 '23 19:02 kud1ing