Implement web_sys::Canvas event listeners
This commit is contained in:
parent
c5703eb00a
commit
b79089ea57
9 changed files with 242 additions and 62 deletions
|
|
@ -24,9 +24,9 @@ impl Window {
|
|||
attr: WindowAttributes,
|
||||
_: PlatformSpecificBuilderAttributes,
|
||||
) -> Result<Self, RootOE> {
|
||||
let canvas = backend::Canvas::create()?;
|
||||
let mut canvas = backend::Canvas::create()?;
|
||||
|
||||
target.register(&canvas);
|
||||
target.register(&mut canvas);
|
||||
|
||||
let runner = target.runner.clone();
|
||||
let redraw = Box::new(move || {
|
||||
|
|
@ -58,6 +58,10 @@ impl Window {
|
|||
Ok(window)
|
||||
}
|
||||
|
||||
pub fn canvas(&self) -> &backend::Canvas {
|
||||
&self.canvas
|
||||
}
|
||||
|
||||
pub fn set_title(&self, title: &str) {
|
||||
backend::Document::set_title(title);
|
||||
}
|
||||
|
|
@ -256,13 +260,6 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "stdweb")]
|
||||
impl WindowExtStdweb for RootWindow {
|
||||
fn canvas(&self) -> CanvasElement {
|
||||
self.window.canvas.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Id;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue