mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-23 18:06:34 +11:00
Focus canvas on setup
This commit is contained in:
parent
a20c9e1592
commit
9c7e084239
1 changed files with 2 additions and 1 deletions
|
@ -516,8 +516,9 @@ pub fn main() -> Result<()> {
|
||||||
web_sys::window()
|
web_sys::window()
|
||||||
.and_then(|win| win.document())
|
.and_then(|win| win.document())
|
||||||
.and_then(|doc| doc.body())
|
.and_then(|doc| doc.body())
|
||||||
.and_then(|body| body.append_child(&web_sys::Element::from(canvas)).ok())
|
.and_then(|body| body.append_child(&web_sys::Element::from(canvas.clone())).ok())
|
||||||
.expect("couldn't append canvas to document body");
|
.expect("couldn't append canvas to document body");
|
||||||
|
_ = web_sys::HtmlElement::from(canvas).focus();
|
||||||
wasm_bindgen_futures::spawn_local(async move {
|
wasm_bindgen_futures::spawn_local(async move {
|
||||||
let size = window.inner_size();
|
let size = window.inner_size();
|
||||||
let surface = render_cx
|
let surface = render_cx
|
||||||
|
|
Loading…
Add table
Reference in a new issue