fix(editor): guard global shortcuts during ui input

This commit is contained in:
ayuan9957 2026-06-17 16:26:51 +08:00
parent 35b394ee37
commit aa66fd30ec

View File

@ -742,12 +742,20 @@ void MetaCoreReimportProjectAsset(MetaCoreEditorContext& editorContext, const Me
} }
} }
void MetaCoreHandleGlobalEditorShortcuts(MetaCoreEditorContext& editorContext) { [[nodiscard]] bool MetaCoreCanHandleGlobalEditorShortcuts() {
const ImGuiIO& io = ImGui::GetIO(); const ImGuiIO& io = ImGui::GetIO();
if (io.WantTextInput) { return !io.WantTextInput &&
!io.WantCaptureKeyboard &&
!ImGui::IsAnyItemActive() &&
!ImGui::IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopup);
}
void MetaCoreHandleGlobalEditorShortcuts(MetaCoreEditorContext& editorContext) {
if (!MetaCoreCanHandleGlobalEditorShortcuts()) {
return; return;
} }
const ImGuiIO& io = ImGui::GetIO();
const bool ctrlDown = io.KeyCtrl; const bool ctrlDown = io.KeyCtrl;
const bool shiftDown = io.KeyShift; const bool shiftDown = io.KeyShift;