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
+8 -6
View File
@@ -22,21 +22,23 @@
#define TIMELINEVIEWBASE_H
#include <QGraphicsView>
#include <vector>
#include "core.h"
#include "timescaledobject.h"
#include "widget/handmovableview/handmovableview.h"
#include "widget/snapservice/snapservice.h"
namespace olive {
class TimeBasedWidget;
class TimeBasedView : public HandMovableView, public TimeScaledObject
{
Q_OBJECT
public:
TimeBasedView(QWidget* parent = nullptr);
void EnableSnap(const QVector<rational> &points);
void EnableSnap(const std::vector<rational> &points);
void DisableSnap();
bool IsSnapped() const
{
@@ -45,8 +47,8 @@ public:
const rational &GetTime() const { return playhead_; }
SnapService *GetSnapService() const { return snap_service_; }
void SetSnapService(SnapService* service);
TimeBasedWidget *GetSnapService() const { return snap_service_; }
void SetSnapService(TimeBasedWidget* service) { snap_service_ = service; }
const double& GetYScale() const;
void SetYScale(const double& y_scale);
@@ -117,11 +119,11 @@ private:
QGraphicsScene scene_;
bool snapped_;
QVector<rational> snap_time_;
std::vector<rational> snap_time_;
rational end_time_;
SnapService* snap_service_;
TimeBasedWidget* snap_service_;
bool y_axis_enabled_;