Merge pull request #7910 from furo321/editor-sync-toggle

Use toggle button instead of checkbox for "Sync envelope button".
This commit is contained in:
Dennis Felsing 2024-02-03 07:55:06 +00:00 committed by GitHub
commit f7ceae5d29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6462,21 +6462,18 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
} }
} }
// sync checkbox // toggle sync button
ToolBar.VSplitLeft(15.0f, nullptr, &ToolBar); ToolBar.VSplitLeft(15.0f, nullptr, &ToolBar);
ToolBar.VSplitLeft(12.0f, &Button, &ToolBar); ToolBar.VSplitLeft(40.0f, &Button, &ToolBar);
static int s_SyncButton; static int s_SyncButton;
if(DoButton_Editor(&s_SyncButton, pEnvelope->m_Synchronized ? "X" : "", 0, &Button, 0, "Synchronize envelope animation to game time (restarts when you touch the start line)")) if(DoButton_Editor(&s_SyncButton, "Sync", pEnvelope->m_Synchronized, &Button, 0, "Synchronize envelope animation to game time (restarts when you touch the start line)"))
{ {
m_EnvelopeEditorHistory.RecordAction(std::make_shared<CEditorActionEnvelopeEdit>(this, m_SelectedEnvelope, CEditorActionEnvelopeEdit::EEditType::SYNC, pEnvelope->m_Synchronized, !pEnvelope->m_Synchronized)); m_EnvelopeEditorHistory.RecordAction(std::make_shared<CEditorActionEnvelopeEdit>(this, m_SelectedEnvelope, CEditorActionEnvelopeEdit::EEditType::SYNC, pEnvelope->m_Synchronized, !pEnvelope->m_Synchronized));
pEnvelope->m_Synchronized = !pEnvelope->m_Synchronized; pEnvelope->m_Synchronized = !pEnvelope->m_Synchronized;
m_Map.OnModify(); m_Map.OnModify();
} }
ToolBar.VSplitLeft(4.0f, nullptr, &ToolBar);
ToolBar.VSplitLeft(40.0f, &Button, &ToolBar);
UI()->DoLabel(&Button, "Sync.", 10.0f, TEXTALIGN_ML);
const bool ShouldPan = s_Operation == EEnvelopeEditorOp::OP_NONE && (UI()->MouseButton(2) || (UI()->MouseButton(0) && Input()->ModifierIsPressed())); const bool ShouldPan = s_Operation == EEnvelopeEditorOp::OP_NONE && (UI()->MouseButton(2) || (UI()->MouseButton(0) && Input()->ModifierIsPressed()));
if(m_pContainerPanned == &s_EnvelopeEditorID) if(m_pContainerPanned == &s_EnvelopeEditorID)
{ {