Skip to content

Implementing drag to reorder tracks in media clipboard (Issue 318)#392

Open
NatalieElizabeth wants to merge 2 commits intodevelopfrom
issue_318
Open

Implementing drag to reorder tracks in media clipboard (Issue 318)#392
NatalieElizabeth wants to merge 2 commits intodevelopfrom
issue_318

Conversation

@NatalieElizabeth
Copy link

Issue 318

Implemented drag-and-drop for reordering tracks in the media clipboard. Created some mouse event overrides to detect dragging behavior with a drag threshold of 5 pixels, and made some changes to the painting of the TrackAreaWidget to display and update a drop line. The appearance (color, thickness) of the drop line can be discussed before merging.

Files modified:
TrackAreaWidget.h

@NatalieElizabeth NatalieElizabeth self-assigned this Feb 27, 2026
@NatalieElizabeth NatalieElizabeth linked an issue Feb 27, 2026 that may be closed by this pull request
@cwitkowitz
Copy link
Collaborator

Great start! I found two small issues:

  1. The tracks are still reordered (and the horizontal bar still shown) if drag/drop is performed outside of the track area (media clipboard)
  2. When moving to a track underneath the current track (i.e., later in the order), the reordering seems to skip a track (resulting in one extra track in between the original and intended ordering)

@NatalieElizabeth
Copy link
Author

Thank you for catching those issues!

The latest commit fixes the downward drag offset issue and ensures that a.) the indicator line won't be drawn if the drag is moved outside the widget, and that b.) the reordering won't occur if the mouse is released outside the widget. You can still start the drag in the widget, move outside the widget, and then move back inside and release the mouse button to reorder, as long as the release is within the bounds of the widget.

Copy link
Collaborator

@cwitkowitz cwitkowitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Only thing I would say is to be wary of calling repaint() in mouseDrag, since this may invoke the function repeatedly over the course of the drag. Obviously, this is necessary to move the delimiter, but repaint() can sometimes be a bulky operation and could slow things down if called in a loop. With that being said, it doesn't seem to be a problem on my end.

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.

Reordering Tracks in Media Clipboard

2 participants