fix(ui): drop all selected Project items into compositions (#351)

Preserve Project multi-selection when dropping onto the Timeline or Composition viewer. Keep stack order and drop position, skip non-layer project items, and add pointer-drag regression coverage.
This commit is contained in:
Nigel Ihza Firdausy
2026-10-11 00:58:35 +07:00
parent 1446e27d85
commit 1922e621c2
4 changed files with 85 additions and 12 deletions
+24
View File
@@ -78,6 +78,30 @@ pub enum DragPayload {
Files(Vec<String>),
}
/// Layers carried by a Project item drag. Dragging a selected item uses the
/// complete selection, while dragging an unselected item uses only that item.
/// Folders and data files are not composition layers.
pub(crate) fn project_drop_items(app: &EffectcraftApp, dragged: u64) -> Vec<u64> {
use effectcraft_engine::project::{FootageKind, ItemId, ItemKind};
let selected = &app.session.state.project_selection;
let candidates: Vec<u64> = if selected.iter().any(|id| id.0 == dragged) {
selected.iter().map(|id| id.0).collect()
} else {
vec![dragged]
};
candidates
.into_iter()
.filter(|id| {
app.session.project.item(ItemId(*id)).is_some_and(|item| match &item.kind {
ItemKind::Comp(_) | ItemKind::Solid(_) => true,
ItemKind::Footage(f) => f.kind != FootageKind::Data,
ItemKind::Folder => false,
})
})
.collect()
}
/// The current time formatted per project settings (timecode with `;` for drop-frame, frames
/// or Feet + Frames).
pub fn timecode(session: &Session, comp: &Comp, t: Tick) -> String {