From 002e44f6278e49bee01075d40ec3edb373bed639 Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Sun, 22 Dec 2024 14:53:52 +0000 Subject: [PATCH] label: fix redrawing shadow on label updates (#599) --- src/renderer/widgets/Label.cpp | 5 ++++- src/renderer/widgets/Label.hpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/renderer/widgets/Label.cpp b/src/renderer/widgets/Label.cpp index 46bcdff..28715ff 100644 --- a/src/renderer/widgets/Label.cpp +++ b/src/renderer/widgets/Label.cpp @@ -119,7 +119,10 @@ bool CLabel::draw(const SRenderData& data) { if (!asset) return true; + } + if (updateShadow) { + updateShadow = false; shadow.markShadowDirty(); } @@ -143,7 +146,7 @@ void CLabel::renderUpdate() { asset = newAsset; resourceID = pendingResourceID; pendingResourceID = ""; - shadow.markShadowDirty(); + updateShadow = true; } else { Debug::log(WARN, "Asset {} not available after the asyncResourceGatherer's callback!", pendingResourceID); diff --git a/src/renderer/widgets/Label.hpp b/src/renderer/widgets/Label.hpp index 0822218..9a41cb5 100644 --- a/src/renderer/widgets/Label.hpp +++ b/src/renderer/widgets/Label.hpp @@ -45,4 +45,5 @@ class CLabel : public IWidget { std::shared_ptr labelTimer = nullptr; CShadowable shadow; + bool updateShadow = true; };