mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Improve envelope editor double-click handling
Only handle the double-click on the envelope editor when the second click is released instead of when it is pressed down already. Remove unnecessary UI element `s_BoxSelectId`, the temporary activation of which was causing the tooltip to be missing for one frame when clicking the envelope editor.
This commit is contained in:
parent
f061dfdc84
commit
264df1f035
|
@ -6334,8 +6334,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
ResetZoomEnvelope(pEnvelope, s_ActiveChannels);
|
||||
}
|
||||
|
||||
static int s_EnvelopeEditorId = 0;
|
||||
|
||||
ColorRGBA aColors[] = {ColorRGBA(1, 0.2f, 0.2f), ColorRGBA(0.2f, 1, 0.2f), ColorRGBA(0.2f, 0.2f, 1), ColorRGBA(1, 1, 0.2f)};
|
||||
|
||||
CUIRect Button;
|
||||
|
@ -6389,6 +6387,8 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
m_Map.OnModify();
|
||||
}
|
||||
|
||||
static int s_EnvelopeEditorId = 0;
|
||||
static int s_EnvelopeEditorButtonUsed = -1;
|
||||
const bool ShouldPan = s_Operation == EEnvelopeEditorOp::OP_NONE && (Ui()->MouseButton(2) || (Ui()->MouseButton(0) && Input()->ModifierIsPressed()));
|
||||
if(m_pContainerPanned == &s_EnvelopeEditorId)
|
||||
{
|
||||
|
@ -6438,6 +6438,16 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
{
|
||||
// do stuff
|
||||
if(Ui()->MouseButton(0))
|
||||
{
|
||||
s_EnvelopeEditorButtonUsed = 0;
|
||||
if(s_Operation != EEnvelopeEditorOp::OP_BOX_SELECT && !Input()->ModifierIsPressed())
|
||||
{
|
||||
s_Operation = EEnvelopeEditorOp::OP_BOX_SELECT;
|
||||
s_MouseXStart = Ui()->MouseX();
|
||||
s_MouseYStart = Ui()->MouseY();
|
||||
}
|
||||
}
|
||||
else if(s_EnvelopeEditorButtonUsed == 0)
|
||||
{
|
||||
if(Input()->MouseDoubleClick())
|
||||
{
|
||||
|
@ -6462,14 +6472,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
RemoveTimeOffsetEnvelope(pEnvelope);
|
||||
m_Map.OnModify();
|
||||
}
|
||||
else if(s_Operation != EEnvelopeEditorOp::OP_BOX_SELECT && !Input()->ModifierIsPressed())
|
||||
{
|
||||
static int s_BoxSelectId = 0;
|
||||
Ui()->SetActiveItem(&s_BoxSelectId);
|
||||
s_Operation = EEnvelopeEditorOp::OP_BOX_SELECT;
|
||||
s_MouseXStart = Ui()->MouseX();
|
||||
s_MouseYStart = Ui()->MouseY();
|
||||
}
|
||||
s_EnvelopeEditorButtonUsed = -1;
|
||||
}
|
||||
|
||||
m_ShowEnvelopePreview = SHOWENV_SELECTED;
|
||||
|
|
Loading…
Reference in a new issue