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
+3 -7
View File
@@ -26,6 +26,7 @@
#include <QTimer>
#include "common/timecodefunctions.h"
#include "widget/timebased/timebasedwidget.h"
namespace olive {
@@ -63,7 +64,7 @@ void TimeBasedView::TimebaseChangedEvent(const rational &)
viewport()->update();
}
void TimeBasedView::EnableSnap(const QVector<rational> &points)
void TimeBasedView::EnableSnap(const std::vector<rational> &points)
{
snapped_ = true;
snap_time_ = points;
@@ -78,11 +79,6 @@ void TimeBasedView::DisableSnap()
viewport()->update();
}
void TimeBasedView::SetSnapService(SnapService *service)
{
snap_service_ = service;
}
const double &TimeBasedView::GetYScale() const
{
return y_scale_;
@@ -211,7 +207,7 @@ bool TimeBasedView::PlayheadMove(QMouseEvent *event)
if (Core::instance()->snapping() && snap_service_) {
rational movement;
snap_service_->SnapPoint({mouse_time}, &movement, SnapService::kSnapAll & ~SnapService::kSnapToPlayhead);
snap_service_->SnapPoint({mouse_time}, &movement, TimeBasedWidget::kSnapAll & ~TimeBasedWidget::kSnapToPlayhead);
mouse_time += movement;
}