Skip to content

Instantly share code, notes, and snippets.

View PPakalns's full-sized avatar
🍒
Cherry Red

Pēteris Pakalns PPakalns

🍒
Cherry Red
View GitHub Profile
@PPakalns
PPakalns / description.md
Created November 10, 2024 14:15
Egui integration with taffy.

Idea based on lucasmerlin ideas https://github.com/lucasmerlin/hello_egui/tree/main/crates

  1. to integrate taffy with egui (egui_taffy) long before egui 0.29 .
  2. to implement flex layout manually (egui_flex) into egui using egui 0.29 new features (request_discard and intrinsic size)

In second attempt more ergonomic API was made where closures didn't need to be stored and could reference mutable data from outer scope.

Taffy can be nicely integrated into egui using egui 0.29 new functionality and similar API as in egui_flex. We do not need to reimplement layouting logic.

See following code example. Still need to clean up this code to make crate out of it, but I am already using it in my personal project.