diff --git a/app/widget/timelinewidget/tool/add.cpp b/app/widget/timelinewidget/tool/add.cpp index d50c57fb0..06393bcf8 100644 --- a/app/widget/timelinewidget/tool/add.cpp +++ b/app/widget/timelinewidget/tool/add.cpp @@ -57,6 +57,7 @@ void TimelineWidget::AddTool::MousePress(TimelineViewMouseEvent *event) // Leave as "none", which means this block can be placed on any track break; case OLIVE_NAMESPACE::Tool::kAddableCount: + // Return so we do nothing return; } @@ -64,6 +65,14 @@ void TimelineWidget::AddTool::MousePress(TimelineViewMouseEvent *event) || add_type == track.type()) { drag_start_point_ = event->GetFrame(); + if (Core::instance()->snapping()) { + rational movement; + parent()->SnapPoint({drag_start_point_}, &movement); + if (!movement.isNull()) { + drag_start_point_ += movement; + } + } + ghost_ = new TimelineViewGhostItem(); ghost_->SetIn(drag_start_point_); ghost_->SetOut(drag_start_point_); @@ -160,6 +169,11 @@ void TimelineWidget::AddTool::MouseMoveInternal(const rational &cursor_frame, bo // Calculate movement rational movement = cursor_frame - drag_start_point_; + // Validation: Ensure in point never goes below 0 + if (movement < -ghost_->In() || (outwards && -movement < -ghost_->In())) { + movement = -ghost_->In(); + } + // Snap movement bool snapped = parent()->SnapPoint(snap_points_, &movement); @@ -171,11 +185,6 @@ void TimelineWidget::AddTool::MouseMoveInternal(const rational &cursor_frame, bo // We don't need to un-neg here because outwards means all future processing will be done both pos and neg } - // Validation: Ensure in point never goes below 0 - if (movement < -ghost_->In() || (outwards && -movement < -ghost_->In())) { - movement = -ghost_->In(); - } - // Make adjustment if (!movement) { ghost_->SetInAdjustment(0);