Add the onvisible event handler to Element (#2911)
* Add the `onvisible` event using the IntersectionObserver * Add a visible example This example is based on https://codepen.io/ryanfinni/pen/VwZeGxN * Remove web-sys CustomEvent feature for html package * update js bindings and hash * Use dioxus doc instead of lorem ipsum * Fix clippy warning * Add get_target method to the event data * Make `get_time` return an Instant instead of a f64 * fix merge conflicts, compilinga * remove target * small nits * serialzie as time_ms * fix timing, works on desktop * remove latent nits, fix hash * box size clippy * fix browserlist cargo.lock --------- Co-authored-by: Evan Almloff <evanalmloff@gmail.com> Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
20 files changed
+961
-289
No files matched your search
@@ -146,6 +146,8 @@ pub trait HtmlEventConverter: Send + Sync {
|
||||
fn convert_touch_data(&self, event: &PlatformEventData) -> TouchData;
|
||||
/// Convert a general event to a transition data event
|
||||
fn convert_transition_data(&self, event: &PlatformEventData) -> TransitionData;
|
||||
/// Convert a general event to a visible data event
|
||||
fn convert_visible_data(&self, event: &PlatformEventData) -> VisibleData;
|
||||
/// Convert a general event to a wheel data event
|
||||
fn convert_wheel_data(&self, event: &PlatformEventData) -> WheelData;
|
||||
}
|
||||
@@ -258,6 +260,12 @@ impl From<&PlatformEventData> for TransitionData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&PlatformEventData> for VisibleData {
|
||||
fn from(val: &PlatformEventData) -> Self {
|
||||
with_event_converter(|c| c.convert_visible_data(val))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&PlatformEventData> for WheelData {
|
||||
fn from(val: &PlatformEventData) -> Self {
|
||||
with_event_converter(|c| c.convert_wheel_data(val))
|
||||
@@ -282,6 +290,7 @@ mod selection;
|
||||
mod toggle;
|
||||
mod touch;
|
||||
mod transition;
|
||||
mod visible;
|
||||
mod wheel;
|
||||
|
||||
pub use animation::*;
|
||||
@@ -302,4 +311,5 @@ pub use selection::*;
|
||||
pub use toggle::*;
|
||||
pub use touch::*;
|
||||
pub use transition::*;
|
||||
pub use visible::*;
|
||||
pub use wheel::*;
|
||||
Reference in new issue
Block a user