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
@@ -134,6 +134,8 @@ pub trait HtmlEventConverter: Send + Sync {
|
||||
fn convert_mouse_data(&self, event: &PlatformEventData) -> MouseData;
|
||||
/// Convert a general event to a pointer data event
|
||||
fn convert_pointer_data(&self, event: &PlatformEventData) -> PointerData;
|
||||
/// Convert a general event to a resize data event
|
||||
fn convert_resize_data(&self, event: &PlatformEventData) -> ResizeData;
|
||||
/// Convert a general event to a scroll data event
|
||||
fn convert_scroll_data(&self, event: &PlatformEventData) -> ScrollData;
|
||||
/// Convert a general event to a selection data event
|
||||
@@ -220,6 +222,12 @@ impl From<&PlatformEventData> for PointerData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&PlatformEventData> for ResizeData {
|
||||
fn from(val: &PlatformEventData) -> Self {
|
||||
with_event_converter(|c| c.convert_resize_data(val))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&PlatformEventData> for ScrollData {
|
||||
fn from(val: &PlatformEventData) -> Self {
|
||||
with_event_converter(|c| c.convert_scroll_data(val))
|
||||
@@ -268,6 +276,7 @@ mod media;
|
||||
mod mounted;
|
||||
mod mouse;
|
||||
mod pointer;
|
||||
mod resize;
|
||||
mod scroll;
|
||||
mod selection;
|
||||
mod toggle;
|
||||
@@ -287,6 +296,7 @@ pub use media::*;
|
||||
pub use mounted::*;
|
||||
pub use mouse::*;
|
||||
pub use pointer::*;
|
||||
pub use resize::*;
|
||||
pub use scroll::*;
|
||||
pub use selection::*;
|
||||
pub use toggle::*;
|
||||
@@ -367,6 +377,7 @@ pub fn event_bubbles(evt: &str) -> bool {
|
||||
"playing" => false,
|
||||
"progress" => false,
|
||||
"ratechange" => false,
|
||||
"resize" => false,
|
||||
"seeked" => false,
|
||||
"seeking" => false,
|
||||
"stalled" => false,
|
||||
|
||||
Reference in new issue
Block a user