timebasedwidget: rewrote scroll catchup code

Code is much better. Less hacky queuing, implements cooldowns to improve navigation, and introduces a framework so that subclasses can make use of catchup/cooldown code too with any scrollbar they want
This commit is contained in:
itsmattkc
2022-07-15 10:59:51 -07:00
parent 4b8febd10d
commit e4fd2d5d2c
11 changed files with 103 additions and 20 deletions
+9 -2
View File
@@ -906,8 +906,7 @@ void TimelineWidget::ViewMouseMoved(TimelineViewMouseEvent *event)
UpdateViewports();
QMetaObject::invokeMethod(this, "CatchUpScrollToPoint", Qt::QueuedConnection,
Q_ARG(int, qRound(event->GetSceneX())));
SetCatchUpScrollValue(event->GetScreenPos().x());
} else {
// Mouse is not down, attempt a hover event
TimelineTool* hover_tool = GetActiveTool();
@@ -922,6 +921,8 @@ void TimelineWidget::ViewMouseMoved(TimelineViewMouseEvent *event)
void TimelineWidget::ViewMouseReleased(TimelineViewMouseEvent *event)
{
StopCatchUpScrollTimer();
if (active_tool_) {
if (GetConnectedNode()) {
active_tool_->MouseRelease(event);
@@ -956,16 +957,22 @@ void TimelineWidget::ViewDragMoved(TimelineViewMouseEvent *event)
{
import_tool_->DragMove(event);
UpdateViewports();
SetCatchUpScrollValue(event->GetScreenPos().x());
}
void TimelineWidget::ViewDragLeft(QDragLeaveEvent *event)
{
StopCatchUpScrollTimer();
import_tool_->DragLeave(event);
UpdateViewports();
}
void TimelineWidget::ViewDragDropped(TimelineViewMouseEvent *event)
{
StopCatchUpScrollTimer();
import_tool_->DragDrop(event);
UpdateViewports();
}