Use Escape to cancel OP_SCALE envelope

This commit is contained in:
Axel Vestin 2023-11-14 21:17:07 +01:00
parent a329417dee
commit 7c15514696

View file

@ -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);