From 897d22b50e19e1c193bfe63b48466ee54f9dd589 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 8 Sep 2024 17:38:14 +0300 Subject: [PATCH] fix container subnodes render --- src/graphics/ui/elements/Container.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graphics/ui/elements/Container.cpp b/src/graphics/ui/elements/Container.cpp index 8d298769..3b8fd0ac 100644 --- a/src/graphics/ui/elements/Container.cpp +++ b/src/graphics/ui/elements/Container.cpp @@ -87,14 +87,15 @@ void Container::draw(const DrawContext* pctx, Assets* assets) { auto batch = pctx->getBatch2D(); batch->texture(nullptr); - batch->flush(); - { + if (!nodes.empty()) { + batch->flush(); DrawContext ctx = pctx->sub(); ctx.setScissors(glm::vec4(pos.x, pos.y, size.x, size.y)); for (const auto& node : nodes) { if (node->isVisible()) node->draw(pctx, assets); } + batch->flush(); } }