Skip to content

Commit

Permalink
Extract ShowPopupEnvPoint local function
Browse files Browse the repository at this point in the history
  • Loading branch information
Robyt3 committed Nov 11, 2023
1 parent 2120baa commit cae7225
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/game/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6263,6 +6263,11 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
}

{
static SPopupMenuId s_PopupEnvPointId;
const auto &&ShowPopupEnvPoint = [&]() {
UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint);
};

if(s_Operation == OP_NONE)
SetHotEnvelopePoint(View, pEnvelope, s_ActiveChannels);

Expand Down Expand Up @@ -6406,8 +6411,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
if(m_vSelectedEnvelopePoints.size() == 1)
{
m_UpdateEnvPointInfo = true;
static SPopupMenuId s_PopupEnvPointId;
UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint);
ShowPopupEnvPoint();
}
else if(m_vSelectedEnvelopePoints.size() > 1)
{
Expand Down Expand Up @@ -6550,8 +6554,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
if(IsTangentOutPointSelected(i, c))
{
m_UpdateEnvPointInfo = true;
static SPopupMenuId s_PopupEnvPointId;
UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint);
ShowPopupEnvPoint();
}
UI()->SetActiveItem(nullptr);
}
Expand Down Expand Up @@ -6683,8 +6686,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
if(IsTangentInPointSelected(i, c))
{
m_UpdateEnvPointInfo = true;
static SPopupMenuId s_PopupEnvPointId;
UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint);
ShowPopupEnvPoint();
}
UI()->SetActiveItem(nullptr);
}
Expand Down

0 comments on commit cae7225

Please sign in to comment.