fix building issues

This commit is contained in:
Charles Edward Gagnon 2024-08-12 20:01:08 -04:00
parent e795c1f8f3
commit fe7d51c70f
2 changed files with 14 additions and 15 deletions

View file

@ -109,11 +109,10 @@ where
move |event: web_sys::MouseEvent| { move |event: web_sys::MouseEvent| {
let result = coord_type.extract_mouse_coords(&event); let result = coord_type.extract_mouse_coords(&event);
if let (x, y) = result { let (x, y) = result;
set_x.set(x); set_x.set(x);
set_y.set(y); set_y.set(y);
set_source_type.set(UseMouseSourceType::Mouse); set_source_type.set(UseMouseSourceType::Mouse);
}
} }
}; };
@ -138,11 +137,10 @@ where
.expect("Just checked that there's at least on touch"), .expect("Just checked that there's at least on touch"),
); );
if let (x, y) = result { let (x, y) = result;
set_x.set(x); set_x.set(x);
set_y.set(y); set_y.set(y);
set_source_type.set(UseMouseSourceType::Touch); set_source_type.set(UseMouseSourceType::Touch);
}
} }
} }
}; };
@ -234,7 +232,7 @@ where
impl Default for UseMouseOptions<UseWindow, web_sys::Window, Infallible> { impl Default for UseMouseOptions<UseWindow, web_sys::Window, Infallible> {
fn default() -> Self { fn default() -> Self {
Self { Self {
coord_type: UseMouseCoordType::<Infallible>::default(), coord_type: UseMouseCoordType::default(),
target: use_window(), target: use_window(),
touch: true, touch: true,
reset_on_touch_ends: false, reset_on_touch_ends: false,
@ -254,7 +252,7 @@ pub enum UseMouseCoordType<E> {
Custom(E), Custom(E),
} }
impl<E> Default for UseMouseCoordType<E> { impl Default for UseMouseCoordType<Infallible> {
fn default() -> Self { fn default() -> Self {
Self::Page Self::Page
} }

View file

@ -1,11 +1,12 @@
use crate::core::{ElementMaybeSignal, Position}; use crate::core::{ElementMaybeSignal, Position};
use crate::{ use crate::{
use_mouse_with_options, use_window, UseMouseCoordType, UseMouseEventExtractor, use_mouse_with_options, use_window, UseMouseCoordType, UseMouseEventExtractor,
UseMouseEventExtractorDefault, UseMouseOptions, UseMouseReturn, UseMouseSourceType, UseWindow, UseMouseOptions, UseMouseReturn, UseMouseSourceType, UseWindow,
}; };
use cfg_if::cfg_if; use cfg_if::cfg_if;
use default_struct_builder::DefaultBuilder; use default_struct_builder::DefaultBuilder;
use leptos::*; use leptos::*;
use std::convert::Infallible;
use std::marker::PhantomData; use std::marker::PhantomData;
/// Reactive mouse position related to an element. /// Reactive mouse position related to an element.
@ -196,11 +197,11 @@ where
} }
impl Default impl Default
for UseMouseInElementOptions<UseWindow, web_sys::Window, UseMouseEventExtractorDefault> for UseMouseInElementOptions<UseWindow, web_sys::Window, Infallible>
{ {
fn default() -> Self { fn default() -> Self {
Self { Self {
coord_type: UseMouseCoordType::<UseMouseEventExtractorDefault>::default(), coord_type: UseMouseCoordType::<Infallible>::default(),
target: use_window(), target: use_window(),
touch: true, touch: true,
reset_on_touch_ends: false, reset_on_touch_ends: false,