tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5544Rust 88Markdown 11TOML 91926 Definitions

Fix commented out variant of basic example (#526)

ae0e31da6d5ce67dd2fe4b09e8e927b6cb40ce32 · by Nico Burns · (3 years ago) · parent 3341abe49 · browse the tree at this commit

Semantic delta · 1

examples/basic.rs

  • body changed fn main

1 files · +5 −3

diff --git a/examples/basic.rs b/examples/basic.rs
index 888fd8164..7a5a0fcc2 100644
--- a/examples/basic.rs
+++ b/examples/basic.rs
@@ -17,14 +17,16 @@ fn main() -> Result<(), taffy::TaffyError> {
         &[child],
     )?;
 
+    println!("Compute layout with 100x100 viewport:");
     taffy.compute_layout(
         node,
         Size { height: AvailableSpace::Definite(100.0), width: AvailableSpace::Definite(100.0) },
     )?;
+    println!("node: {:#?}", taffy.layout(node)?);
+    println!("child: {:#?}", taffy.layout(child)?);
 
-    // or just use undefined for 100 x 100
-    // taffy.compute_layout(node, Size::NONE)?;
-
+    println!("Compute layout with undefined (infinite) viewport:");
+    taffy.compute_layout(node, Size::MAX_CONTENT)?;
     println!("node: {:#?}", taffy.layout(node)?);
     println!("child: {:#?}", taffy.layout(child)?);