From 7c155146964277e9cdbb4e23e900d9597e2195e9 Mon Sep 17 00:00:00 2001 From: Axel Vestin Date: Tue, 14 Nov 2023 21:17:07 +0100 Subject: [PATCH] Use Escape to cancel OP_SCALE envelope --- src/game/editor/editor.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 990149151..fe459343e 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -373,7 +373,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in s_TextMode = false; } - if(Input()->KeyIsPressed(KEY_ESCAPE)) + if(UI()->ConsumeHotkey(CUI::HOTKEY_ESCAPE)) { UI()->DisableMouseLock(); UI()->SetActiveItem(nullptr); @@ -6874,7 +6874,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) { s_Operation = OP_NONE; } - else if(UI()->MouseButton(1)) + else if(UI()->MouseButton(1) || UI()->ConsumeHotkey(CUI::HOTKEY_ESCAPE)) { for(size_t k = 0; k < m_vSelectedEnvelopePoints.size(); k++) { @@ -7199,7 +7199,7 @@ void CEditor::RenderMenubar(CUIRect MenuBar) UI()->DoLabel(&Info, aBuf, 10.0f, TEXTALIGN_MR); static int s_CloseButton = 0; - if(DoButton_Editor(&s_CloseButton, "×", 0, &Close, 0, "Exits from the editor") || (m_Dialog == DIALOG_NONE && !UI()->IsPopupOpen() && !m_PopupEventActivated && Input()->KeyPress(KEY_ESCAPE))) + if(DoButton_Editor(&s_CloseButton, "×", 0, &Close, 0, "Exits from the editor")) { OnClose(); g_Config.m_ClEditor = 0; @@ -7460,6 +7460,12 @@ void CEditor::Render() UI()->RenderPopupMenus(); FreeDynamicPopupMenus(); + if(m_Dialog == DIALOG_NONE && !m_PopupEventActivated && UI()->ConsumeHotkey(CUI::HOTKEY_ESCAPE)) + { + OnClose(); + g_Config.m_ClEditor = 0; + } + // The tooltip can be set in popup menus so we have to render the tooltip after the popup menus. if(m_GuiActive) RenderTooltip(TooltipRect);