Merge pull request #7456 from apelsin21/exit_OP_SCALE

Use Escape to cancel OP_SCALE envelope
This commit is contained in:
Robert Müller 2023-11-14 22:22:21 +00:00 committed by GitHub
commit f726fbf16c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -373,7 +373,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
s_TextMode = false; s_TextMode = false;
} }
if(Input()->KeyIsPressed(KEY_ESCAPE)) if(UI()->ConsumeHotkey(CUI::HOTKEY_ESCAPE))
{ {
UI()->DisableMouseLock(); UI()->DisableMouseLock();
UI()->SetActiveItem(nullptr); UI()->SetActiveItem(nullptr);
@ -6874,7 +6874,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
{ {
s_Operation = OP_NONE; 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++) 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); UI()->DoLabel(&Info, aBuf, 10.0f, TEXTALIGN_MR);
static int s_CloseButton = 0; 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(); OnClose();
g_Config.m_ClEditor = 0; g_Config.m_ClEditor = 0;
@ -7460,6 +7460,12 @@ void CEditor::Render()
UI()->RenderPopupMenus(); UI()->RenderPopupMenus();
FreeDynamicPopupMenus(); 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. // The tooltip can be set in popup menus so we have to render the tooltip after the popup menus.
if(m_GuiActive) if(m_GuiActive)
RenderTooltip(TooltipRect); RenderTooltip(TooltipRect);