diff --git a/packages/desktop/src/events.rs b/packages/desktop/src/events.rs index ee26d2fbc..2a44a7d78 100644 --- a/packages/desktop/src/events.rs +++ b/packages/desktop/src/events.rs @@ -8,7 +8,7 @@ use dioxus_core::{ on::{MouseEvent, MouseEventInner}, SyntheticEvent, }, - ElementId, EventPriority, EventTrigger, ScopeId, + ElementId, EventPriority, ScopeId, UiEvent, }; #[derive(serde::Serialize, serde::Deserialize)] @@ -17,14 +17,14 @@ struct ImEvent { mounted_dom_id: u64, scope: u64, } -pub fn trigger_from_serialized(val: serde_json::Value) -> EventTrigger { +pub fn trigger_from_serialized(val: serde_json::Value) -> UiEvent { let mut data: Vec = serde_json::from_value(val).unwrap(); let data = data.drain(..).next().unwrap(); let event = SyntheticEvent::MouseEvent(MouseEvent(Rc::new(WebviewMouseEvent))); let scope = ScopeId(data.scope as usize); let mounted_dom_id = Some(ElementId(data.mounted_dom_id as usize)); - EventTrigger { + UiEvent { event, scope, mounted_dom_id, diff --git a/packages/web/src/dom.rs b/packages/web/src/dom.rs index 5a62bfe76..d4c282980 100644 --- a/packages/web/src/dom.rs +++ b/packages/web/src/dom.rs @@ -1,7 +1,7 @@ use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc}; use dioxus_core::{ - events::{on::GenericEventInner, EventTrigger, SyntheticEvent}, + events::{on::GenericEventInner, SyntheticEvent, UiEvent}, mutations::NodeRefMutation, scheduler::SchedulerMsg, DomEdit, ElementId, ScopeId, @@ -519,7 +519,7 @@ fn virtual_event_from_websys_event(event: web_sys::Event) -> SyntheticEvent { /// This function decodes a websys event and produces an EventTrigger /// With the websys implementation, we attach a unique key to the nodes -fn decode_trigger(event: &web_sys::Event) -> anyhow::Result { +fn decode_trigger(event: &web_sys::Event) -> anyhow::Result { log::debug!("Handling event!"); let target = event @@ -561,7 +561,7 @@ fn decode_trigger(event: &web_sys::Event) -> anyhow::Result { let triggered_scope = gi_id; // let triggered_scope: ScopeId = KeyData::from_ffi(gi_id).into(); log::debug!("Triggered scope is {:#?}", triggered_scope); - Ok(EventTrigger { + Ok(UiEvent { event: virtual_event_from_websys_event(event.clone()), mounted_dom_id: Some(ElementId(real_id as usize)), scope: ScopeId(triggered_scope as usize),