Fix UI document host input integration build

This commit is contained in:
2026-04-05 21:52:30 +08:00
parent 578f5dd99c
commit dc0e8b938f
2 changed files with 609 additions and 75 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <XCEngine/UI/Input/UIInputDispatcher.h>
#include <XCEngine/UI/Runtime/UIScreenTypes.h>
#include <cstdint>
@@ -22,6 +23,20 @@ public:
class UIDocumentScreenHost final : public IUIScreenDocumentHost {
public:
struct InputDebugSnapshot {
std::uint64_t totalPointerEventCount = 0u;
UIPoint pointerPosition = {};
bool pointerInsideViewport = false;
std::string hoveredStateKey = {};
std::string focusedStateKey = {};
std::string activeStateKey = {};
std::string captureStateKey = {};
std::string lastEventType = {};
std::string lastTargetStateKey = {};
std::string lastTargetKind = {};
std::string lastResult = {};
};
struct ScrollDebugSnapshot {
std::uint64_t totalWheelEventCount = 0u;
std::uint64_t handledWheelEventCount = 0u;
@@ -42,10 +57,20 @@ public:
UIScreenFrameResult BuildFrame(
const UIScreenDocument& document,
const UIScreenFrameInput& input) override;
const InputDebugSnapshot& GetInputDebugSnapshot() const;
const ScrollDebugSnapshot& GetScrollDebugSnapshot() const;
private:
struct PointerState {
UIPoint position = {};
bool hasPosition = false;
bool insideViewport = false;
};
UIInputDispatcher m_inputDispatcher;
std::unordered_map<std::string, float> m_verticalScrollOffsets = {};
PointerState m_pointerState = {};
InputDebugSnapshot m_inputDebugSnapshot = {};
ScrollDebugSnapshot m_scrollDebugSnapshot = {};
};