pub trait WindowExtWebSys {
// Required methods
fn canvas(&self) -> Option<HtmlCanvasElement>;
fn prevent_default(&self) -> bool;
fn set_prevent_default(&self, prevent_default: bool);
}
Required Methods§
Sourcefn canvas(&self) -> Option<HtmlCanvasElement>
fn canvas(&self) -> Option<HtmlCanvasElement>
Only returns the canvas if called from inside the window context (the main thread).
Sourcefn prevent_default(&self) -> bool
fn prevent_default(&self) -> bool
Returns true
if calling event.preventDefault()
is enabled.
See Window::set_prevent_default()
for more details.
Sourcefn set_prevent_default(&self, prevent_default: bool)
fn set_prevent_default(&self, prevent_default: bool)
Sets whether event.preventDefault()
should be called on events on the
canvas that have side effects.
For example, by default using the mouse wheel would cause the page to scroll, enabling this would prevent that.
Some events are impossible to prevent. E.g. Firefox allows to access the native browser context menu with Shift+Rightclick.