From bda57d564b9b1d75775b94c49435c4c374aa3940 Mon Sep 17 00:00:00 2001 From: Lucas Meurer Date: Thu, 4 Jan 2024 19:03:22 +0100 Subject: [PATCH] Fix egui_taffy --- crates/egui_taffy/src/lib.rs | 6 +++--- fancy-example/src/main.rs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/egui_taffy/src/lib.rs b/crates/egui_taffy/src/lib.rs index a741755..23a1a73 100644 --- a/crates/egui_taffy/src/lib.rs +++ b/crates/egui_taffy/src/lib.rs @@ -7,7 +7,7 @@ use taffy::prelude::*; type Node = NodeId; struct TaffyState { - taffy: Taffy<(usize, egui::Layout)>, + taffy: TaffyTree<(usize, egui::Layout)>, children: Vec, @@ -28,7 +28,7 @@ unsafe impl Sync for TaffyState {} impl TaffyState { pub fn new() -> Self { - let mut taffy = Taffy::new(); + let mut taffy = TaffyTree::new(); Self { root_node: taffy.new_with_children(Style::default(), &[]).unwrap(), @@ -271,7 +271,7 @@ impl<'a, 'f> TaffyPass<'a, 'f> { let result_rect = response.response.rect; Size { - width: result_rect.width().ceil(), + width: result_rect.width().ceil() + 0.01, height: result_rect.height(), } }, diff --git a/fancy-example/src/main.rs b/fancy-example/src/main.rs index ff53042..11e6fe4 100644 --- a/fancy-example/src/main.rs +++ b/fancy-example/src/main.rs @@ -1,5 +1,4 @@ use std::hash::Hash; -use std::time::Duration; use eframe::egui::Color32; use eframe::emath::lerp; @@ -138,7 +137,7 @@ fn main() -> eframe::Result<()> { std::thread::spawn(move || { rt.block_on(async { loop { - tokio::time::sleep(Duration::from_secs(3600)).await; + tokio::time::sleep(std::time::Duration::from_secs(3600)).await; } }) });