timebasedviewselectionmanager: scale/unscale when dragging too
This commit is contained in:
@@ -258,9 +258,7 @@ void KeyframeView::CatchUpScrollEvent()
|
||||
{
|
||||
super::CatchUpScrollEvent();
|
||||
|
||||
if (this->selection_manager_.IsRubberBanding()) {
|
||||
this->selection_manager_.RubberBandMove(this->viewport()->mapFromGlobal(QCursor::pos()));
|
||||
}
|
||||
this->selection_manager_.ForceDragUpdate();
|
||||
}
|
||||
|
||||
void KeyframeView::mousePressEvent(QMouseEvent *event)
|
||||
@@ -296,7 +294,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent *event)
|
||||
} else if (selection_manager_.IsDragging()) {
|
||||
QString tip;
|
||||
KeyframeDragMove(event, tip);
|
||||
selection_manager_.DragMove(event, tip);
|
||||
selection_manager_.DragMove(event->pos(), tip);
|
||||
} else if (selection_manager_.IsRubberBanding()) {
|
||||
selection_manager_.RubberBandMove(event->pos());
|
||||
Redraw();
|
||||
@@ -629,9 +627,7 @@ void KeyframeView::ShowKeyframePropertiesDialog()
|
||||
|
||||
void KeyframeView::UpdateRubberBandForScroll()
|
||||
{
|
||||
if (this->selection_manager_.IsRubberBanding()) {
|
||||
this->selection_manager_.RubberBandMove(this->viewport()->mapFromGlobal(QCursor::pos()));
|
||||
}
|
||||
this->selection_manager_.ForceDragUpdate();
|
||||
}
|
||||
|
||||
void KeyframeView::Redraw()
|
||||
|
||||
@@ -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_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ void SeekableWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
selection_manager_.RubberBandMove(event->pos());
|
||||
viewport()->update();
|
||||
} else if (selection_manager_.IsDragging()) {
|
||||
selection_manager_.DragMove(event);
|
||||
selection_manager_.DragMove(event->pos());
|
||||
} else if (dragging_) {
|
||||
QPointF scene = mapToScene(event->pos());
|
||||
if (resize_item_) {
|
||||
@@ -422,9 +422,7 @@ void SeekableWidget::CatchUpScrollEvent()
|
||||
{
|
||||
super::CatchUpScrollEvent();
|
||||
|
||||
if (this->selection_manager_.IsRubberBanding()) {
|
||||
this->selection_manager_.RubberBandMove(this->viewport()->mapFromGlobal(QCursor::pos()));
|
||||
}
|
||||
this->selection_manager_.ForceDragUpdate();
|
||||
}
|
||||
|
||||
void SeekableWidget::DrawPlayhead(QPainter *p, int x, int y)
|
||||
|
||||
Reference in New Issue
Block a user