GroveEngine/modules/UIModule/Widgets/UIPanel.cpp
StillHammer 5cef0e25b0 fix: UIModule button interaction + JsonDataNode array children support
- Fix JsonDataNode::getChildReadOnly() to handle JSON array access by numeric index
- Fix test_ui_showcase to use JSON array for children (matching test_single_button pattern)
- Add visual test files: test_single_button, test_ui_showcase, test_sprite_debug
- Clean up debug logging from SpritePass, SceneCollector, UIButton, BgfxDevice

The root cause was that UITree couldn't access array children in JSON layouts.
UIButton hover/click now works correctly in both test files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-05 18:23:16 +07:00

30 lines
780 B
C++

#include "UIPanel.h"
#include "../Core/UIContext.h"
#include "../Core/UILayout.h"
#include "../Rendering/UIRenderer.h"
#include <spdlog/spdlog.h>
namespace grove {
void UIPanel::update(UIContext& ctx, float deltaTime) {
// Apply layout if this panel has a non-absolute layout mode
if (layoutProps.mode != LayoutMode::Absolute) {
// Measure and layout children
UILayout::measure(this);
UILayout::layout(this, width, height);
}
// Update children
updateChildren(ctx, deltaTime);
}
void UIPanel::render(UIRenderer& renderer) {
// Render background rectangle
renderer.drawRect(absX, absY, width, height, bgColor);
// Render children on top
renderChildren(renderer);
}
} // namespace grove