This commit is contained in:
Maurice Kayser authored and GitHub committed 2023-01-01 14:41:18 -06:00
1 parent fd86420c08
commit c8f88b6428
7 files changed
+23 -23

No files matched your search

+7 -7
View File
@@ -23,7 +23,7 @@ use std::{
pub struct Event<T: 'static + ?Sized> {
/// The data associated with this event
pub data: Rc<T>,
pub(crate) propogates: Rc<Cell<bool>>,
pub(crate) propagates: Rc<Cell<bool>>,
}
impl<T> Event<T> {
@@ -40,9 +40,9 @@ impl<T> Event<T> {
/// }
/// }
/// ```
#[deprecated = "use stop_propogation instead"]
#[deprecated = "use stop_propagation instead"]
pub fn cancel_bubble(&self) {
self.propogates.set(false);
self.propagates.set(false);
}
/// Prevent this event from continuing to bubble up the tree to parent elements.
@@ -58,8 +58,8 @@ impl<T> Event<T> {
/// }
/// }
/// ```
pub fn stop_propogation(&self) {
self.propogates.set(false);
pub fn stop_propagation(&self) {
self.propagates.set(false);
}
/// Get a reference to the inner data from this event
@@ -84,7 +84,7 @@ impl<T> Event<T> {
impl<T: ?Sized> Clone for Event<T> {
fn clone(&self) -> Self {
Self {
propogates: self.propogates.clone(),
propagates: self.propagates.clone(),
data: self.data.clone(),
}
}
@@ -100,7 +100,7 @@ impl<T> std::ops::Deref for Event<T> {
impl<T: std::fmt::Debug> std::fmt::Debug for Event<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("UiEvent")
.field("bubble_state", &self.propogates)
.field("bubble_state", &self.propagates)
.field("data", &self.data)
.finish()
}
+1 -1
View File
@@ -499,7 +499,7 @@ impl<'src> ScopeState {
BumpBox::from_raw(self.bump().alloc(move |event: Event<dyn Any>| {
if let Ok(data) = event.data.downcast::<T>() {
callback(Event {
propogates: event.propogates,
propagates: event.propagates,
data,
})
}
+2 -2
View File
@@ -347,7 +347,7 @@ impl VirtualDom {
// We will clone this later. The data itself is wrapped in RC to be used in callbacks if required
let uievent = Event {
propogates: Rc::new(Cell::new(bubbles)),
propagates: Rc::new(Cell::new(bubbles)),
data,
};
@@ -388,7 +388,7 @@ impl VirtualDom {
cb(uievent.clone());
}
if !uievent.propogates.get() {
if !uievent.propagates.get() {
return;
}
}