diff --git a/libs/ui/include/psemek/ui/element.hpp b/libs/ui/include/psemek/ui/element.hpp index ee057f66..f5ea9058 100644 --- a/libs/ui/include/psemek/ui/element.hpp +++ b/libs/ui/include/psemek/ui/element.hpp @@ -81,6 +81,7 @@ namespace psemek::ui std::shared_ptr own_style_; mutable std::shared_ptr merged_style_; mutable std::shared_ptr merged_own_style_; + bool reshape_posted_ = false; mutable std::vector> delayed_callbacks_; diff --git a/libs/ui/source/element.cpp b/libs/ui/source/element.cpp index 620b186a..db66204f 100644 --- a/libs/ui/source/element.cpp +++ b/libs/ui/source/element.cpp @@ -130,10 +130,17 @@ namespace psemek::ui void element::post_reshape() { + if (root()->reshape_posted_) + return; + + root()->reshape_posted_ = true; auto weak_self = weak_from_this(); post([weak_self]{ if (auto self = weak_self.lock()) + { self->root()->reshape(); + self->root()->reshape_posted_ = false; + } }); }