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

View file

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