Skip to content

False magnets when closing a gap#1876

Closed
Proggerdogger wants to merge 1 commit into
mltframework:masterfrom
Proggerdogger:fix/false-magnets-gap
Closed

False magnets when closing a gap#1876
Proggerdogger wants to merge 1 commit into
mltframework:masterfrom
Proggerdogger:fix/false-magnets-gap

Conversation

@Proggerdogger

@Proggerdogger Proggerdogger commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Two changes, first on my quest to fix shotcut bugs I noticed that often snapping would not snap to the edge of a clip but slightly inside of it. I fixed this by rounding snap targets to whole frames (as every clip is a certain number of whole frames you never want to snap onto a decimal place).

Reproduce

  1. New project, magnet/snap on.
  2. Put two clips on the same track with a 1-frame gap (or a project where a tiny blank sits between them).
  3. Zoom the timeline all the way out (very small scale / minimum zoom).
  4. Drag the right clip left until it snaps to the left clip.
  5. Zoom all the way in at the join.
    Before: the join is 1 frame short or overlapped, or a transition appears on drop.
    After: the clips abut on the same frame (no gap, no 1-frame overlap).

Second, when dragging a clip to join with another clip it feels like the join fails for no reason. I made it so that instead of stopping part way through joining to the next clip (this was due to hitting a magnet that really shouldn't be present), the join completes, whilst also keeping snapping to playhead working and joining to clips in other sections (e.g. V1 can still snap to V2 clips). I will note that if the playhead and the edge of a clip are nearby, snapping now preferences the edge of the clip which is probably fine but tell me if it creates issues.

Reproduce

  1. Same track: two clips with a 2-frame blank between them.
  2. Magnet/snap on. Set zoom so about 1 frame ≈ SNAP (roughly 10 px per frame / scaleFactor ≈ 10).
  3. Optionally put the playhead in the gap (makes the bug clearer).
  4. Drag the right clip left to close the gap.

Before: the clip sticks about halfway across the gap (~0.016s on a ~0.033s gap) or snaps to the blank/playhead instead of the real join.
After: the clip joins the left clip’s edge in one magnet action.
Still works: snap to playhead when not closing a same-track gap; V1↔V2 cross-track snap when home isn’t mid-join.

Change 2 partially relies on change 1, so I am bundling these together.

The build-shotcut-linux failure is not from this change. CI clones mltframework/shotcut and runs git checkout origin/, but the branch only exists on my fork, so checkout fails before compiling.

When dragging a clip to join with another clip it feels like the join fails for no reason. I made it so that instead of stopping part way through joining to the next clip (this was due to hitting a magnet that really shouldn't be present), the join completes, whilst also keeping snapping to playhead working and joining to clips in other sections (e.g. V1 can still snap to V2 clips). I will note that if the playhead and the edge of a clip are nearby, snapping now preferences the edge of the clip which is probably fine but tell me if it creates issues.

## Reproduce

1. Same track: two clips with a 2-frame blank between them.
2. Magnet/snap on. Set zoom so about 1 frame ≈ SNAP (roughly 10 px per frame / scaleFactor ≈ 10).
3. Optionally put the playhead in the gap (makes the bug clearer).
4. Drag the right clip left to close the gap.

Before: the clip sticks about halfway across the gap (~0.016s on a ~0.033s gap) or snaps to the blank/playhead instead of the real join.
After: the clip joins the left clip’s edge in one magnet action.
Still works: snap to playhead when not closing a same-track gap; V1↔V2 cross-track snap when home isn’t mid-join.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ddennedy

Copy link
Copy Markdown
Member

I’m not going to accept all these changes for something so minor especially after the regression. Just move the playhead out of the way.

@ddennedy ddennedy closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants