Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Merge main into #1095 (Escape-cancel in the icon view drag)

Brandon Thomasde9a262e1186
diff --cc crates/ui-egui/src/panels/project_views.rs
index ea93ccef6,02a63b164..8a2bca5b9
--- a/crates/ui-egui/src/panels/project_views.rs
+++ b/crates/ui-egui/src/panels/project_views.rs
@@@ -1042,8 -1023,14 +1049,14 @@@ pub fn freeform_view(app: &mut Filmcraf
ui.painter().text(br.center(), Align2::CENTER_CENTER, format!("×{n}"), Tokens::ui(10.0), Color32::WHITE);
app.auto.add(&format!("{}.stack.{s}", v.prefix), br, &format!("Stack of {n}"));
}
- item_interactions(app, ui, &resp, ItemId(c.item), &kind, actions, false, false);
+ item_interactions(app, ui, v, &resp, ItemId(c.item), &kind, actions, false, false);
- if resp.dragged() {
+ // Escape puts the cards back and drops nothing until the button comes up (#580); egui
+ // also ends the drag on Escape, so it arrives as a stop as often as during the drag
+ let escape = ui.input(|i| i.key_pressed(egui::Key::Escape));
+ if (resp.dragged() || resp.drag_stopped()) && (escape || crate::panels::drag_cancelled(ui)) {
+ ui.ctx().data_mut(|d| d.remove::<(u64, egui::Vec2)>(drag_key));
+ crate::panels::cancel_drag(ui);
+ } else if resp.dragged() {
let total = dragging.filter(|d| d.0 == c.item).map(|d| d.1).unwrap_or_default() + resp.drag_delta();
ui.ctx().data_mut(|d| d.insert_temp(drag_key, (c.item, total)));
// leaving the panel turns the move into an item drag (to the Timeline, a monitor)