implemented snapping

This commit is contained in:
itsmattkc
2019-09-17 23:01:51 +10:00
parent 16a4897236
commit 93492bd51e
5 changed files with 114 additions and 0 deletions
+11
View File
@@ -24,6 +24,7 @@
#include "config/config.h"
#include "common/qtversionabstraction.h"
#include "core.h"
#include "node/distort/transform/transform.h"
#include "node/color/opacity/opacity.h"
#include "node/input/media/media.h"
@@ -119,6 +120,16 @@ void TimelineView::ImportTool::DragMove(QDragMoveEvent *event)
time_movement = ValidateFrameMovement(time_movement, parent()->ghost_items_);
// If snapping is enabled, check for snap points
if (olive::core.snapping()) {
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
if (SnapPoint(ghost->In(), &time_movement)
|| SnapPoint(ghost->Out(), &time_movement)) {
break;
}
}
}
// Move ghosts to the mouse cursor
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
ghost->SetInAdjustment(time_movement);