From 79d7f76407050421095a470371049b0c902e26e1 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 31 May 2024 23:50:49 -0500 Subject: [PATCH] [jasper/world/studio] WorldEditor: suppress keyboard when popup open --- .../studio/worldeditor/worldeditor-imgui.cpp | 22 ++++++++++--------- .../studio/worldeditor/worldeditor-imgui.hpp | 4 ++++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.cpp b/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.cpp index cfb57de..c11bf81 100644 --- a/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.cpp +++ b/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.cpp @@ -296,16 +296,18 @@ void WorldEditorImGui::drawWorldView() noexcept { return handleDrop(fbPaneScale); }); handleMouseSelection(fbPaneScale); - auto const&io = ImGui::GetIO(); - if (io.KeyCtrl) { - if (io.KeysDown[ImGuiKey_G]) { - clearSelection(); - } else if (io.KeysDown[ImGuiKey_A]) { - m_selection.emplace(ox::Point{0, 0}, ox::Point{m_doc.columns - 1, m_doc.rows - 1}); - m_view.setSelection(*m_selection); - setCopyEnabled(true); - setCutEnabled(true); - setPasteEnabled(true); + if (!popupOpen()) { + auto const&io = ImGui::GetIO(); + if (io.KeyCtrl) { + if (io.KeysDown[ImGuiKey_G]) { + clearSelection(); + } else if (io.KeysDown[ImGuiKey_A]) { + m_selection.emplace(ox::Point{0, 0}, ox::Point{m_doc.columns - 1, m_doc.rows - 1}); + m_view.setSelection(*m_selection); + setCopyEnabled(true); + setCutEnabled(true); + setPasteEnabled(true); + } } } } diff --git a/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.hpp b/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.hpp index 275898c..20cd8d3 100644 --- a/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.hpp +++ b/src/jasper/modules/world/src/studio/worldeditor/worldeditor-imgui.hpp @@ -104,6 +104,10 @@ class WorldEditorImGui: public studio::Editor { ox::Result assetId() const noexcept; ox::Error addDependency(ox::FileAddress const&fileAddr) noexcept; + + constexpr bool popupOpen() const noexcept { + return m_sizeEditor.show; + } }; }