[jasper/world/studio] WorldEditor: suppress keyboard when popup open

This commit is contained in:
Gary Talent 2024-05-31 23:50:49 -05:00
parent bec487552f
commit 79d7f76407
2 changed files with 16 additions and 10 deletions

View File

@ -296,16 +296,18 @@ void WorldEditorImGui::drawWorldView() noexcept {
return handleDrop(fbPaneScale); return handleDrop(fbPaneScale);
}); });
handleMouseSelection(fbPaneScale); handleMouseSelection(fbPaneScale);
auto const&io = ImGui::GetIO(); if (!popupOpen()) {
if (io.KeyCtrl) { auto const&io = ImGui::GetIO();
if (io.KeysDown[ImGuiKey_G]) { if (io.KeyCtrl) {
clearSelection(); if (io.KeysDown[ImGuiKey_G]) {
} else if (io.KeysDown[ImGuiKey_A]) { clearSelection();
m_selection.emplace(ox::Point{0, 0}, ox::Point{m_doc.columns - 1, m_doc.rows - 1}); } else if (io.KeysDown[ImGuiKey_A]) {
m_view.setSelection(*m_selection); m_selection.emplace(ox::Point{0, 0}, ox::Point{m_doc.columns - 1, m_doc.rows - 1});
setCopyEnabled(true); m_view.setSelection(*m_selection);
setCutEnabled(true); setCopyEnabled(true);
setPasteEnabled(true); setCutEnabled(true);
setPasteEnabled(true);
}
} }
} }
} }

View File

@ -104,6 +104,10 @@ class WorldEditorImGui: public studio::Editor {
ox::Result<ox::UUID> assetId() const noexcept; ox::Result<ox::UUID> assetId() const noexcept;
ox::Error addDependency(ox::FileAddress const&fileAddr) noexcept; ox::Error addDependency(ox::FileAddress const&fileAddr) noexcept;
constexpr bool popupOpen() const noexcept {
return m_sizeEditor.show;
}
}; };
} }