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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user