timebasedviewselectionmanager: scale/unscale when dragging too

This commit is contained in:
itsmattkc
2023-03-11 13:49:41 -08:00
parent 9f4124beb3
commit 3e47da7009
3 changed files with 23 additions and 19 deletions
@@ -206,7 +206,7 @@ public:
}
}
drag_mouse_start_ = view_->mapToScene(event->pos());
drag_mouse_start_ = view_->UnscalePoint(view_->mapToScene(event->pos()));
}
void SnapPoints(rational *movement)
@@ -233,9 +233,9 @@ public:
}
}
void DragMove(QMouseEvent *event, const QString &tip_format = QString())
void DragMove(const QPoint &local_pos, const QString &tip_format = QString())
{
rational time_diff = view_->SceneToTimeNoGrid(view_->mapToScene(event->pos()).x() - drag_mouse_start_.x());
rational time_diff = view_->SceneToTimeNoGrid(view_->mapToScene(local_pos).x() - view_->ScalePoint(drag_mouse_start_).x());
// Snap points
rational presnap_time_diff = time_diff;
@@ -313,6 +313,7 @@ public:
display_time, timebase_,
Core::instance()->GetTimecodeDisplay(), false));
last_used_tip_format_ = tip_format;
if (!tip_format.isEmpty()) {
tip = tip_format.arg(tip);
}
@@ -321,11 +322,6 @@ public:
QToolTip::showText(QCursor::pos(), tip);
}
void DragMove(QMouseEvent *event, TimeTargetObject *target)
{
return DragMove(event, QString(), target);
}
void DragStop(MultiUndoCommand *command)
{
QToolTip::hideText();
@@ -388,6 +384,18 @@ public:
return rubberband_;
}
void ForceDragUpdate()
{
if (IsRubberBanding() || IsDragging()) {
QPoint local_pos = view_->viewport()->mapFromGlobal(QCursor::pos());
if (IsRubberBanding()) {
RubberBandMove(local_pos);
} else {
DragMove(local_pos, last_used_tip_format_);
}
}
}
private:
class SetTimeCommand : public UndoCommand
{
@@ -455,6 +463,8 @@ private:
TimeTargetObject *time_target_;
QString last_used_tip_format_;
};
}