mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 06:10:06 -04:00
Remove unnecessary import of wasm_bindgen::JsCast (its now in prelude)
This commit is contained in:
@@ -450,8 +450,6 @@ pub enum EventToUnsubscribe {
|
|||||||
|
|
||||||
impl EventToUnsubscribe {
|
impl EventToUnsubscribe {
|
||||||
pub fn unsubscribe(self) -> Result<(), JsValue> {
|
pub fn unsubscribe(self) -> Result<(), JsValue> {
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
EventToUnsubscribe::TargetEvent(handle) => {
|
EventToUnsubscribe::TargetEvent(handle) => {
|
||||||
handle.target.remove_event_listener_with_callback(
|
handle.target.remove_event_listener_with_callback(
|
||||||
@@ -486,8 +484,6 @@ impl AppRunnerContainer {
|
|||||||
event_name: &'static str,
|
event_name: &'static str,
|
||||||
mut closure: impl FnMut(E, MutexGuard<'_, AppRunner>) + 'static,
|
mut closure: impl FnMut(E, MutexGuard<'_, AppRunner>) + 'static,
|
||||||
) -> Result<(), JsValue> {
|
) -> Result<(), JsValue> {
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
|
|
||||||
// Create a JS closure based on the FnMut provided
|
// Create a JS closure based on the FnMut provided
|
||||||
let closure = Closure::wrap({
|
let closure = Closure::wrap({
|
||||||
// Clone atomics
|
// Clone atomics
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ pub fn paint_and_schedule(
|
|||||||
runner_ref: AppRunnerRef,
|
runner_ref: AppRunnerRef,
|
||||||
panicked: Arc<AtomicBool>,
|
panicked: Arc<AtomicBool>,
|
||||||
) -> Result<(), JsValue> {
|
) -> Result<(), JsValue> {
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
let window = web_sys::window().unwrap();
|
let window = web_sys::window().unwrap();
|
||||||
let closure = Closure::once(move || paint_and_schedule(&runner_ref, panicked));
|
let closure = Closure::once(move || paint_and_schedule(&runner_ref, panicked));
|
||||||
window.request_animation_frame(closure.as_ref().unchecked_ref())?;
|
window.request_animation_frame(closure.as_ref().unchecked_ref())?;
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ pub fn system_theme() -> Option<Theme> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn canvas_element(canvas_id: &str) -> Option<web_sys::HtmlCanvasElement> {
|
pub fn canvas_element(canvas_id: &str) -> Option<web_sys::HtmlCanvasElement> {
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
let document = web_sys::window()?.document()?;
|
let document = web_sys::window()?.document()?;
|
||||||
let canvas = document.get_element_by_id(canvas_id)?;
|
let canvas = document.get_element_by_id(canvas_id)?;
|
||||||
canvas.dyn_into::<web_sys::HtmlCanvasElement>().ok()
|
canvas.dyn_into::<web_sys::HtmlCanvasElement>().ok()
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use wasm_bindgen::prelude::*;
|
|||||||
static AGENT_ID: &str = "egui_text_agent";
|
static AGENT_ID: &str = "egui_text_agent";
|
||||||
|
|
||||||
pub fn text_agent() -> web_sys::HtmlInputElement {
|
pub fn text_agent() -> web_sys::HtmlInputElement {
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
web_sys::window()
|
web_sys::window()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.document()
|
.document()
|
||||||
@@ -23,7 +22,6 @@ pub fn text_agent() -> web_sys::HtmlInputElement {
|
|||||||
|
|
||||||
/// Text event handler,
|
/// Text event handler,
|
||||||
pub fn install_text_agent(runner_container: &mut AppRunnerContainer) -> Result<(), JsValue> {
|
pub fn install_text_agent(runner_container: &mut AppRunnerContainer) -> Result<(), JsValue> {
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
let window = web_sys::window().unwrap();
|
let window = web_sys::window().unwrap();
|
||||||
let document = window.document().unwrap();
|
let document = window.document().unwrap();
|
||||||
let body = document.body().expect("document should have a body");
|
let body = document.body().expect("document should have a body");
|
||||||
@@ -129,7 +127,6 @@ pub fn install_text_agent(runner_container: &mut AppRunnerContainer) -> Result<(
|
|||||||
|
|
||||||
/// Focus or blur text agent to toggle mobile keyboard.
|
/// Focus or blur text agent to toggle mobile keyboard.
|
||||||
pub fn update_text_agent(runner: MutexGuard<'_, AppRunner>) -> Option<()> {
|
pub fn update_text_agent(runner: MutexGuard<'_, AppRunner>) -> Option<()> {
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
use web_sys::HtmlInputElement;
|
use web_sys::HtmlInputElement;
|
||||||
let window = web_sys::window()?;
|
let window = web_sys::window()?;
|
||||||
let document = window.document()?;
|
let document = window.document()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user