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 c48623d commit d8452ad
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 @@ -6269,6 +6269,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 @@ -6412,8 +6417,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 @@ -6556,8 +6560,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 @@ -6689,8 +6692,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 d8452ad

Please sign in to comment.