moved autoscroll code to TimeBasedWidget rather than TimelineViewBase
Better place for it. Fixes #1406
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#include <QScrollBar>
|
||||
#include <QTimer>
|
||||
|
||||
#include "common/autoscroll.h"
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "config/config.h"
|
||||
|
||||
@@ -115,18 +114,6 @@ void TimelineViewBase::SetTime(const int64_t time)
|
||||
{
|
||||
playhead_ = time;
|
||||
|
||||
switch (static_cast<AutoScroll::Method>(Config::Current()["Autoscroll"].toInt())) {
|
||||
case AutoScroll::kNone:
|
||||
// Do nothing
|
||||
break;
|
||||
case AutoScroll::kPage:
|
||||
QMetaObject::invokeMethod(this, "PageScrollToPlayhead", Qt::QueuedConnection);
|
||||
break;
|
||||
case AutoScroll::kSmooth:
|
||||
emit RequestCenterScrollOnPlayhead();
|
||||
break;
|
||||
}
|
||||
|
||||
// Force redraw for playhead
|
||||
viewport()->update();
|
||||
}
|
||||
@@ -257,21 +244,6 @@ void TimelineViewBase::UpdateSceneRect()
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineViewBase::PageScrollToPlayhead()
|
||||
{
|
||||
int playhead_pos = qRound(GetPlayheadX());
|
||||
|
||||
int viewport_padding = viewport()->width() / 16;
|
||||
|
||||
if (playhead_pos < horizontalScrollBar()->value()) {
|
||||
// Anchor the playhead to the RIGHT of where we scroll to
|
||||
horizontalScrollBar()->setValue(playhead_pos - viewport()->width() + viewport_padding);
|
||||
} else if (playhead_pos > horizontalScrollBar()->value() + viewport()->width()) {
|
||||
// Anchor the playhead to the LEFT of where we scroll to
|
||||
horizontalScrollBar()->setValue(playhead_pos - viewport_padding);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineViewBase::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QGraphicsView::resizeEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user