Update more examples, add css for more examples
This commit is contained in:
19 files changed
+228
-101
No files matched your search
@@ -1,4 +1,9 @@
|
||||
#![allow(clippy::await_holding_refcell_ref)]
|
||||
//! Read the size of elements using the MountedData struct.
|
||||
//!
|
||||
//! Whenever an Element is finally mounted to the Dom, its data is avaiable to be read.
|
||||
//! These fields can typically only be read asynchronously, since various renderers need to release the main thread to
|
||||
//! perform layout and painting.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use dioxus::{html::geometry::euclid::Rect, prelude::*};
|
||||
@@ -33,6 +38,7 @@ fn app() -> Element {
|
||||
let read_dims = move |_| async move {
|
||||
let read = div_element.read();
|
||||
let client_rect = read.as_ref().map(|el| el.get_client_rect());
|
||||
|
||||
if let Some(client_rect) = client_rect {
|
||||
if let Ok(rect) = client_rect.await {
|
||||
dimensions.set(rect);
|
||||
|
||||
Reference in new issue
Block a user