Feat: yeet, synthetic somewhat wired up
This commit is contained in:
1 parent
3087813570
commit
d9598066c2
7 files changed
+79
-47
No files matched your search
@@ -1,7 +1,7 @@
|
||||
use std::{borrow::Borrow, fmt::Debug, sync::Arc};
|
||||
use std::{borrow::Borrow, convert::TryInto, fmt::Debug, sync::Arc};
|
||||
|
||||
use dioxus_core::{
|
||||
events::{EventTrigger, MouseEvent, VirtualEvent},
|
||||
events::{EventTrigger, VirtualEvent},
|
||||
patch::Edit,
|
||||
prelude::ScopeIdx,
|
||||
};
|
||||
@@ -481,30 +481,34 @@ impl PatchMachine {
|
||||
Edit::RemoveKnown => {}
|
||||
}
|
||||
}
|
||||
|
||||
// // 24
|
||||
// pub fn save_template(&mut self, id: CacheId) {
|
||||
// let template = self.stack.top();
|
||||
// let t = template.clone_node_with_deep(true).unwrap();
|
||||
// // self.templates.insert(id, t);
|
||||
// }
|
||||
|
||||
// // 25
|
||||
// pub fn push_template(&mut self, id: CacheId) {
|
||||
// let template = self.get_template(id).unwrap();
|
||||
// let t = template.clone_node_with_deep(true).unwrap();
|
||||
// self.stack.push(t);
|
||||
// }
|
||||
|
||||
// pub fn has_template(&self, id: CacheId) -> bool {
|
||||
// todo!()
|
||||
// // self.templates.contains_key(&id)
|
||||
// }
|
||||
}
|
||||
|
||||
fn virtual_event_from_websys_event(event: &web_sys::Event) -> VirtualEvent {
|
||||
use dioxus_core::events::on::*;
|
||||
match event.type_().as_str() {
|
||||
"click" => VirtualEvent::MouseEvent(MouseEvent {}),
|
||||
"click" | "contextmenu" | "doubleclick" | "drag" | "dragend" | "dragenter" | "dragexit"
|
||||
| "dragleave" | "dragover" | "dragstart" | "drop" | "mousedown" | "mouseenter"
|
||||
| "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup" => {
|
||||
let evt: web_sys::MouseEvent = event.clone().dyn_into().unwrap();
|
||||
VirtualEvent::MouseEvent(MouseEvent(Box::new(RawMouseEvent {
|
||||
alt_key: evt.alt_key(),
|
||||
button: evt.button() as i32,
|
||||
buttons: evt.buttons() as i32,
|
||||
client_x: evt.client_x(),
|
||||
client_y: evt.client_y(),
|
||||
ctrl_key: evt.ctrl_key(),
|
||||
meta_key: evt.meta_key(),
|
||||
page_x: evt.page_x(),
|
||||
page_y: evt.page_y(),
|
||||
screen_x: evt.screen_x(),
|
||||
screen_y: evt.screen_y(),
|
||||
shift_key: evt.shift_key(),
|
||||
get_modifier_state: GetModifierKey(Box::new(|f| {
|
||||
// evt.get_modifier_state(f)
|
||||
todo!("This is not yet implemented properly, sorry :(");
|
||||
})),
|
||||
})))
|
||||
}
|
||||
_ => VirtualEvent::OtherEvent,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user