forge
Explore
Log in

Don't you dare go Hollow

The line goes with the hand that left the row

Browse files at this commit

318f1fda71b7e45dfc630ae97dc22538590996e6Ahmet Kaan GümüşParent: 9ddffc8
  • fix
    • the line goes with the hand that left the row
Show full message
💄 fix(timeline): the line goes with the hand that left the row

A header carried off a row left its drop line painted there, promising a
slot the release out in the open never commits to. The row takes its own
line back down now -- its own, because gpui runs a drag-move listener on
every painted row and not only on the one under the pointer, so a row
clearing the cue outright would rub out the line the hovered row had just
drawn.
crates/app/src/main.rsmodified+10 -0
@@ -3999,6 +3999,16 @@ impl Player {
3999 }3999 }
4000 }4000 }
4001 4001
4002+ /// The line taken back down again, by the row that drew it and by no other:
4003+ /// the pointer has been carried off `lane`, so the slot it was promising is
4004+ /// no longer the one a release would commit to.
4005+ fn forget_lane_drop(&mut self, lane: Lane, cx: &mut Context<Self>) {
4006+ if self.lane_drop.is_some_and(|d| d.lane == lane) {
4007+ self.lane_drop = None;
4008+ cx.notify();
4009+ }
4010+ }
4011+
4002 /// The same shadow for a library row: its head at [`Player::place_frame`],4012 /// The same shadow for a library row: its head at [`Player::place_frame`],
4003 /// which is where the drop inserts it, and the file's own length for its4013 /// which is where the drop inserts it, and the file's own length for its
4004 /// width -- the length the library row already reports. A file this lane4014 /// width -- the length the library row already reports. A file this lane
crates/app/src/ui/timeline.rsmodified+8 -1
@@ -822,8 +822,15 @@ impl Player {
822 }))822 }))
823 .on_drag_move(cx.listener(823 .on_drag_move(cx.listener(
824 move |this, event: &DragMoveEvent<LaneDrag>, _, cx| {824 move |this, event: &DragMoveEvent<LaneDrag>, _, cx| {
825+ // Carried off this row, the line it was promising goes with
826+ // it: a cue left painted over a slot a release out here does
827+ // not commit is the drag saying one thing and the drop
828+ // doing another. Its *own* promise only -- gpui runs this on
829+ // every painted row, not just the one under the pointer, so
830+ // a row that cleared the cue outright would rub out the line
831+ // the hovered row had just drawn.
825 if !event.bounds.contains(&event.event.position) {832 if !event.bounds.contains(&event.event.position) {
826- return;833+ return this.forget_lane_drop(lane, cx);
827 }834 }
828 this.preview_lane_drop(event.drag(cx).0, lane, cx);835 this.preview_lane_drop(event.drag(cx).0, lane, cx);
829 },836 },