dioxus
dioxus copied to clipboard
Canvas API support?
Any examples of using the canvas to draw graphics?
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.
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.
@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
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.