fix the ondouble click desktop test
This commit is contained in:
1 parent
8f70509bc3
commit
53422ae199
2 files changed
+11
-17
No files matched your search
@@ -6,7 +6,7 @@ macro_rules! impl_event {
|
|||||||
$data:ty;
|
$data:ty;
|
||||||
$(
|
$(
|
||||||
$( #[$attr:meta] )*
|
$( #[$attr:meta] )*
|
||||||
$name:ident
|
$name:ident $(: $js_name:literal)?
|
||||||
)*
|
)*
|
||||||
) => {
|
) => {
|
||||||
$(
|
$(
|
||||||
@@ -14,7 +14,7 @@ macro_rules! impl_event {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn $name<'a, E: crate::EventReturn<T>, T>(_cx: &'a ::dioxus_core::ScopeState, mut _f: impl FnMut(::dioxus_core::Event<$data>) -> E + 'a) -> ::dioxus_core::Attribute<'a> {
|
pub fn $name<'a, E: crate::EventReturn<T>, T>(_cx: &'a ::dioxus_core::ScopeState, mut _f: impl FnMut(::dioxus_core::Event<$data>) -> E + 'a) -> ::dioxus_core::Attribute<'a> {
|
||||||
::dioxus_core::Attribute::new(
|
::dioxus_core::Attribute::new(
|
||||||
stringify!($name),
|
impl_event!(@name $name $($js_name)?),
|
||||||
_cx.listener(move |e: ::dioxus_core::Event<crate::PlatformEventData>| {
|
_cx.listener(move |e: ::dioxus_core::Event<crate::PlatformEventData>| {
|
||||||
_f(e.map(|e|e.into())).spawn(_cx);
|
_f(e.map(|e|e.into())).spawn(_cx);
|
||||||
}),
|
}),
|
||||||
@@ -24,6 +24,13 @@ macro_rules! impl_event {
|
|||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(@name $name:ident $js_name:literal) => {
|
||||||
|
$js_name
|
||||||
|
};
|
||||||
|
(@name $name:ident) => {
|
||||||
|
stringify!($name)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static EVENT_CONVERTER: RwLock<Option<Box<dyn HtmlEventConverter>>> = RwLock::new(None);
|
static EVENT_CONVERTER: RwLock<Option<Box<dyn HtmlEventConverter>>> = RwLock::new(None);
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ impl_event! {
|
|||||||
#[deprecated(since = "0.5.0", note = "use ondoubleclick instead")]
|
#[deprecated(since = "0.5.0", note = "use ondoubleclick instead")]
|
||||||
ondblclick
|
ondblclick
|
||||||
|
|
||||||
|
ondoubleclick: "ondblclick"
|
||||||
|
|
||||||
/// onmousedown
|
/// onmousedown
|
||||||
onmousedown
|
onmousedown
|
||||||
|
|
||||||
@@ -102,21 +104,6 @@ impl_event! {
|
|||||||
onmouseup
|
onmouseup
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ondoubleclick
|
|
||||||
#[inline]
|
|
||||||
pub fn ondoubleclick<'a, E: crate::EventReturn<T>, T>(
|
|
||||||
_cx: &'a ::dioxus_core::ScopeState,
|
|
||||||
mut _f: impl FnMut(::dioxus_core::Event<MouseData>) -> E + 'a,
|
|
||||||
) -> ::dioxus_core::Attribute<'a> {
|
|
||||||
::dioxus_core::Attribute::new(
|
|
||||||
"ondblclick",
|
|
||||||
_cx.listener(move |e: ::dioxus_core::Event<MouseData>| {
|
|
||||||
_f(e).spawn(_cx);
|
|
||||||
}),
|
|
||||||
None,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl MouseData {
|
impl MouseData {
|
||||||
/// Create a new instance of MouseData
|
/// Create a new instance of MouseData
|
||||||
|
|||||||
Reference in new issue
Block a user