Bug fixes for Qt TAS editor playback cursor following.

This commit is contained in:
mjbudd77 2021-12-11 10:02:22 -05:00
parent cd1d8f643e
commit fd208cb8f8
2 changed files with 37 additions and 1 deletions

View File

@ -3591,6 +3591,7 @@ QPianoRoll::QPianoRoll(QWidget *parent)
lineOffset = 0;
maxLineOffset = 0;
playbackCursorPos = 0;
dragMode = DRAG_MODE_NONE;
dragSelectionStartingFrame = 0;
dragSelectionEndingFrame = 0;
@ -5330,8 +5331,41 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
vbar->show();
}
if ( taseditorConfig->followPlaybackCursor )
{
lineOffset = maxLineOffset - vbar->value();
if ( playbackCursorPos != currFrameCounter )
{
int lineOffsetLowerLim, lineOffsetUpperLim;
playbackCursorPos = currFrameCounter;
lineOffsetLowerLim = playbackCursorPos - nrow + 5;
lineOffsetUpperLim = playbackCursorPos + nrow;
//if ( !lineIsVisible( playbackCursorPos ) )
if ( lineOffset < lineOffsetLowerLim )
{
lineOffset = lineOffsetLowerLim;
vbar->setValue( maxLineOffset - lineOffset );
}
else if ( lineOffset > lineOffsetUpperLim )
{
lineOffset = lineOffsetUpperLim - nrow;
if ( lineOffset < 0 )
{
lineOffset = 0;
}
vbar->setValue( maxLineOffset - lineOffset );
}
}
}
else
{
vbar->setValue( maxLineOffset - lineOffset );
}
if ( lineOffset < 0 )
{
lineOffset = 0;

View File

@ -236,6 +236,8 @@ class QPianoRoll : public QWidget
int mouse_x;
int mouse_y;
int playbackCursorPos;
bool useDarkTheme;
public slots: