Don't post ui reshape if one if already posted
This commit is contained in:
parent
4281093b9d
commit
2004f8043a
2 changed files with 8 additions and 0 deletions
|
|
@ -81,6 +81,7 @@ namespace psemek::ui
|
||||||
std::shared_ptr<struct style const> own_style_;
|
std::shared_ptr<struct style const> own_style_;
|
||||||
mutable std::shared_ptr<struct style const> merged_style_;
|
mutable std::shared_ptr<struct style const> merged_style_;
|
||||||
mutable std::shared_ptr<struct style const> merged_own_style_;
|
mutable std::shared_ptr<struct style const> merged_own_style_;
|
||||||
|
bool reshape_posted_ = false;
|
||||||
|
|
||||||
mutable std::vector<util::function<void()>> delayed_callbacks_;
|
mutable std::vector<util::function<void()>> delayed_callbacks_;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,17 @@ namespace psemek::ui
|
||||||
|
|
||||||
void element::post_reshape()
|
void element::post_reshape()
|
||||||
{
|
{
|
||||||
|
if (root()->reshape_posted_)
|
||||||
|
return;
|
||||||
|
|
||||||
|
root()->reshape_posted_ = true;
|
||||||
auto weak_self = weak_from_this();
|
auto weak_self = weak_from_this();
|
||||||
post([weak_self]{
|
post([weak_self]{
|
||||||
if (auto self = weak_self.lock())
|
if (auto self = weak_self.lock())
|
||||||
|
{
|
||||||
self->root()->reshape();
|
self->root()->reshape();
|
||||||
|
self->root()->reshape_posted_ = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue