[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);
});
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);
}
}
}
}

View File

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