Extract XCUI selection model and layout lab click selection

This commit is contained in:
2026-04-05 07:03:51 +08:00
parent d46dcbfa9e
commit 646e5855ce
10 changed files with 202 additions and 15 deletions

View File

@@ -241,6 +241,7 @@ void XCUILayoutLabPanel::Render() {
input.pointerPosition = UI::UIPoint(ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
input.pointerInside = validCanvas && ImGui::IsItemHovered();
}
input.pointerPressed = input.pointerInside && ImGui::IsMouseClicked(ImGuiMouseButton_Left);
const ::XCEngine::Editor::XCUIBackend::XCUILayoutLabFrameResult& frame = m_runtime.Update(input);
@@ -337,17 +338,19 @@ void XCUILayoutLabPanel::Render() {
"Native note: %s",
stats.nativeOverlayStatusMessage.empty() ? "none" : stats.nativeOverlayStatusMessage.c_str());
ImGui::Text(
"Hovered: %s | canvas: %.0f x %.0f",
"Hovered: %s | Selected: %s | canvas: %.0f x %.0f",
stats.hoveredElementId.empty() ? "none" : stats.hoveredElementId.c_str(),
stats.selectedElementId.empty() ? "none" : stats.selectedElementId.c_str(),
input.canvasRect.width,
input.canvasRect.height);
ImGui::SeparatorText("Input");
ImGui::Text(
"Pointer: %.0f, %.0f | inside %s",
"Pointer: %.0f, %.0f | inside %s | pressed %s",
input.pointerPosition.x,
input.pointerPosition.y,
input.pointerInside ? "yes" : "no");
input.pointerInside ? "yes" : "no",
input.pointerPressed ? "yes" : "no");
ImGui::EndChild();
ImGui::End();