Add the onresize event handler to Element (#2479)
* Add the capability to handle resize event for web target * Add the capability to handle resize event for desktop target * Return all the sizes, not just the first one * Fix conversion from platform to generic ResizedData for liveview * Update the generated interpreter js code base * Fix clippy warnings * Fix inconsistent use of block_size and inline_size * Rename `onresized` event to `onresize` * Remove the the special-casing logic from the binding logic * Propagating the resize events using CustomEvent * Fix case convention in core ts * revert changes to unified bindings * Cleanup as suggested * add a resize example * Fix desktop resize events * remove tracing from resize example * use the raw resize entry so we can downcast on web * remove unused ResizeEventDetail --------- Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
1 parent
4d6fb74e87
commit
2f49a89638
19 files changed
+442
-50
No files matched your search
@@ -13,7 +13,7 @@ use dioxus_core::{ElementId, Template};
|
||||
use dioxus_interpreter_js::unified_bindings::Interpreter;
|
||||
use rustc_hash::FxHashMap;
|
||||
use wasm_bindgen::{closure::Closure, JsCast};
|
||||
use web_sys::{Document, Element, Event};
|
||||
use web_sys::{Document, Element, Event, Node};
|
||||
|
||||
use crate::{load_document, virtual_event_from_websys_event, Config, WebEventConverter};
|
||||
|
||||
@@ -146,6 +146,11 @@ fn walk_event_for_id(event: &web_sys::Event) -> Option<(ElementId, web_sys::Elem
|
||||
.expect("missing target")
|
||||
.dyn_into::<web_sys::Node>()
|
||||
.expect("not a valid node");
|
||||
|
||||
walk_element_for_id(&target)
|
||||
}
|
||||
|
||||
fn walk_element_for_id(target: &Node) -> Option<(ElementId, web_sys::Element)> {
|
||||
let mut current_target_element = target.dyn_ref::<web_sys::Element>().cloned();
|
||||
|
||||
loop {
|
||||
|
||||
Reference in new issue
Block a user