mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-02-02 10:54:15 -05:00
cleanup
This commit is contained in:
parent
fdb0ac856b
commit
6bd92ca05a
2 changed files with 10 additions and 15 deletions
|
@ -28,7 +28,6 @@ members = [
|
||||||
"use_element_size",
|
"use_element_size",
|
||||||
"use_element_visibility",
|
"use_element_visibility",
|
||||||
"use_event_listener",
|
"use_event_listener",
|
||||||
"use_event_source",
|
|
||||||
"use_favicon",
|
"use_favicon",
|
||||||
"use_floor",
|
"use_floor",
|
||||||
"use_geolocation",
|
"use_geolocation",
|
||||||
|
|
|
@ -2,7 +2,6 @@ use crate::core::{ElementMaybeSignal, Size};
|
||||||
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 wasm_bindgen::prelude::wasm_bindgen;
|
|
||||||
|
|
||||||
cfg_if! { if #[cfg(not(feature = "ssr"))] {
|
cfg_if! { if #[cfg(not(feature = "ssr"))] {
|
||||||
use crate::{use_resize_observer_with_options, UseResizeObserverOptions};
|
use crate::{use_resize_observer_with_options, UseResizeObserverOptions};
|
||||||
|
@ -137,10 +136,18 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
set_width.set(format_box_size.iter().fold(0.0, |acc, v| {
|
set_width.set(format_box_size.iter().fold(0.0, |acc, v| {
|
||||||
acc + v.as_ref().clone().unchecked_into::<BoxSize>().inline_size()
|
acc + v
|
||||||
|
.as_ref()
|
||||||
|
.clone()
|
||||||
|
.unchecked_into::<web_sys::ResizeObserverSize>()
|
||||||
|
.inline_size()
|
||||||
}));
|
}));
|
||||||
set_height.set(format_box_size.iter().fold(0.0, |acc, v| {
|
set_height.set(format_box_size.iter().fold(0.0, |acc, v| {
|
||||||
acc + v.as_ref().clone().unchecked_into::<BoxSize>().block_size()
|
acc + v
|
||||||
|
.as_ref()
|
||||||
|
.clone()
|
||||||
|
.unchecked_into::<web_sys::ResizeObserverSize>()
|
||||||
|
.block_size()
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
// fallback
|
// fallback
|
||||||
|
@ -192,14 +199,3 @@ pub struct UseElementSizeReturn {
|
||||||
/// The height of the element.
|
/// The height of the element.
|
||||||
pub height: Signal<f64>,
|
pub height: Signal<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
|
||||||
extern "C" {
|
|
||||||
type BoxSize;
|
|
||||||
|
|
||||||
#[wasm_bindgen(method, getter = blockSize)]
|
|
||||||
fn block_size(this: &BoxSize) -> f64;
|
|
||||||
|
|
||||||
#[wasm_bindgen(method, getter = inlineSize)]
|
|
||||||
fn inline_size(this: &BoxSize) -> f64;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue