reworked and vastly improved snapping subsystem

This commit is contained in:
itsmattkc
2022-05-02 00:01:49 -07:00
parent 756ff77ae8
commit e6d4fe43de
29 changed files with 289 additions and 225 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ void AddTool::MousePress(TimelineViewMouseEvent *event)
ghost_->SetTrack(track);
parent()->AddGhost(ghost_);
snap_points_.append(drag_start_point_);
snap_points_.push_back(drag_start_point_);
}
}
+2 -2
View File
@@ -243,8 +243,8 @@ void ImportTool::FootageToGhosts(rational ghost_start, const DraggedFootageData
ghost->SetMediaIn(ghost_in);
ghost->SetTrack(Track::Reference(track_type, track_offsets.at(track_type)));
snap_points_.append(ghost->GetIn());
snap_points_.append(ghost->GetOut());
snap_points_.push_back(ghost->GetIn());
snap_points_.push_back(ghost->GetOut());
// Increment track count for this track type
track_offsets[track_type]++;
+5 -4
View File
@@ -35,6 +35,7 @@
#include "pointer.h"
#include "widget/nodeview/nodeviewundo.h"
#include "widget/timelinewidget/undo/timelineundopointer.h"
#include "widget/timeruler/timeruler.h"
namespace olive {
@@ -793,14 +794,14 @@ void PointerTool::AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::Movem
// Prepare snap points (optimizes snapping for later)
switch (mode) {
case Timeline::kMove:
snap_points_.append(ghost->GetIn());
snap_points_.append(ghost->GetOut());
snap_points_.push_back(ghost->GetIn());
snap_points_.push_back(ghost->GetOut());
break;
case Timeline::kTrimIn:
snap_points_.append(ghost->GetIn());
snap_points_.push_back(ghost->GetIn());
break;
case Timeline::kTrimOut:
snap_points_.append(ghost->GetOut());
snap_points_.push_back(ghost->GetOut());
break;
default:
break;
+1 -1
View File
@@ -78,7 +78,7 @@ protected:
void InsertGapsAtGhostDestination(MultiUndoCommand* command);
QVector<rational> snap_points_;
std::vector<rational> snap_points_;
bool dragging_;
@@ -73,7 +73,7 @@ void TransitionTool::MousePress(TimelineViewMouseEvent *event)
parent()->AddGhost(ghost_);
snap_points_.append(transition_start_point);
snap_points_.push_back(transition_start_point);
// Set the drag start point
drag_start_point_ = event->GetFrame();