vastly improved rubberband selection behavior with selection manager widgets

This commit is contained in:
itsmattkc
2023-02-28 20:21:38 -08:00
parent ee666d8862
commit 9ff6e689d6
11 changed files with 80 additions and 28 deletions
+17 -1
View File
@@ -254,6 +254,15 @@ bool KeyframeView::Paste(std::function<Node *(const QString &)> find_node_functi
return false;
}
void KeyframeView::CatchUpScrollEvent()
{
super::CatchUpScrollEvent();
if (this->selection_manager_.IsRubberBanding()) {
this->selection_manager_.RubberBandMove(this->viewport()->mapFromGlobal(QCursor::pos()));
}
}
void KeyframeView::mousePressEvent(QMouseEvent *event)
{
NodeKeyframe *key_under_cursor = selection_manager_.GetObjectAtPoint(event->pos());
@@ -289,7 +298,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent *event)
KeyframeDragMove(event, tip);
selection_manager_.DragMove(event, tip);
} else if (selection_manager_.IsRubberBanding()) {
selection_manager_.RubberBandMove(event);
selection_manager_.RubberBandMove(event->pos());
Redraw();
}
@@ -618,6 +627,13 @@ void KeyframeView::ShowKeyframePropertiesDialog()
}
}
void KeyframeView::UpdateRubberBandForScroll()
{
if (this->selection_manager_.IsRubberBanding()) {
this->selection_manager_.RubberBandMove(this->viewport()->mapFromGlobal(QCursor::pos()));
}
}
void KeyframeView::Redraw()
{
viewport()->update();