From 4033406430a76d35a5abda536547f95bde321d97 Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Tue, 28 May 2024 14:31:09 +0200 Subject: [PATCH] Automation Editor - Fix automation point forced snapping to integer value. (#7282) * Revert "Fix glitch with automation points (#7269)" This reverts commit d60fd0d022ba66571bb31eea3a0fa422ba97bf26. * Fix glitch in Automation Editor. This reverts the earlier fix and tries to solve the issue by instead rounding off the values of the top/bottom levels before comparison with the automation point value. --------- Co-authored-by: Dalton Messmer --- src/gui/editors/AutomationEditor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 9c9e4fd26..41042f524 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1647,14 +1647,14 @@ float AutomationEditor::getLevel(int y ) { int level_line_y = height() - SCROLLBAR_SIZE - 1; // pressed level - float level = ( ( m_bottomLevel + ( m_y_auto ? + float level = std::roundf( ( m_bottomLevel + ( m_y_auto ? ( m_maxLevel - m_minLevel ) * ( level_line_y - y ) / (float)( level_line_y - ( TOP_MARGIN + 2 ) ) : ( level_line_y - y ) / (float)m_y_delta ) ) / m_step ) * m_step; // some range-checking-stuff - level = qBound( m_bottomLevel, level, m_topLevel ); + level = qBound(std::roundf(m_bottomLevel), level, std::roundf(m_topLevel)); - return std::roundf(level); + return level; }