Skip to content

Commit

Permalink
recalculate selected nodes on pointer operation
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattkc committed Dec 29, 2021
1 parent 46bf333 commit 3c95ff7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/widget/timelinewidget/timelinewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,7 @@ void TimelineWidget::SetSelections(const TimelineWidgetSelections &s, bool proce
}
}

// NOTE: This loop could do with some optimization
for (auto it=s.cbegin(); it!=s.cend(); it++) {
Track *track = GetTrackFromReference(it.key());
if (track) {
Expand Down
2 changes: 0 additions & 2 deletions app/widget/timelinewidget/timelinewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,6 @@ class TimelineWidget : public TimeBasedWidget, public NodeCopyPasteService, publ

QVector<Block*> GetBlocksInGlobalRect(const QPoint &p1, const QPoint &p2);

QVector<Block*> GetBlocksInSelection(const TimelineWidgetSelections &sel);

QPoint drag_origin_;

QRubberBand rubberband_;
Expand Down
6 changes: 3 additions & 3 deletions app/widget/timelinewidget/tool/pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
} else {
new_sel.TrimOut(reference_ghost->GetOutAdjustment());
}
command->add_child(new TimelineWidget::SetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), false));
command->add_child(new TimelineWidget::SetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), true));
}
}

Expand Down Expand Up @@ -621,7 +621,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
TimelineWidgetSelections new_sel = parent()->GetSelections();
new_sel.ShiftTime(blocks_moving.first().ghost->GetInAdjustment());
new_sel.ShiftTracks(drag_track_type_, blocks_moving.first().ghost->GetTrackAdjustment());
command->add_child(new TimelineWidget::SetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), false));
command->add_child(new TimelineWidget::SetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), true));
}

if (!blocks_sliding.isEmpty()) {
Expand Down Expand Up @@ -682,7 +682,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
// Adjust selections
TimelineWidgetSelections new_sel = parent()->GetSelections();
new_sel.ShiftTime(movement);
command->add_child(new TimelineWidget::SetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), false));
command->add_child(new TimelineWidget::SetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), true));
}
}

Expand Down

0 comments on commit 3c95ff7

Please sign in to comment.