mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-01 08:11:40 +00:00
ui: a file dropped on a floating Timeline joins that composition (#2661)
Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
This commit is contained in:
1 parent
ec7ced1f05
commit
440db189a5
3 files changed
+15
-1
No files matched your search
@@ -530,6 +530,11 @@ impl EffectcraftApp {
|
||||
let typing = ctx.egui_wants_keyboard_input();
|
||||
let events = events.into_iter().filter(|event| !typing && !matches!(event, egui::Event::Text(_) | egui::Event::Ime(_)));
|
||||
self.forwarded.events.extend(events);
|
||||
// A floating window's drop names the panel under its pointer, which the main window's
|
||||
// pointer can never hit (#2661).
|
||||
if files.iter().any(|window| matches!(window.panel, PanelKind::Timeline)) {
|
||||
self.forwarded.dropped_on_timeline = true;
|
||||
}
|
||||
self.forwarded.files.extend(files.into_iter().flat_map(|window| window.dropped));
|
||||
if !self.forwarded.events.is_empty() || !self.forwarded.files.is_empty() {
|
||||
ctx.request_repaint();
|
||||
|
||||
@@ -442,6 +442,10 @@ impl FileDialogsUp {
|
||||
pub(crate) struct ForwardedInput {
|
||||
pub(crate) events: Vec<egui::Event>,
|
||||
pub(crate) files: Vec<egui::DroppedFileHandle>,
|
||||
/// Files handed over by a floating window whose panel under the pointer was the Timeline. The
|
||||
/// paths lose the window they came from, so this keeps the one thing the import still needs
|
||||
/// (#2661); each drop clears it.
|
||||
pub(crate) dropped_on_timeline: bool,
|
||||
}
|
||||
|
||||
/// Record the scale the viewer drew at (called by the viewer panel each pass).
|
||||
|
||||
@@ -63,6 +63,10 @@ pub fn dropped_files(app: &mut EffectcraftApp, ui: &egui::Ui, bounds: Rect) {
|
||||
errors.push(crate::i18n::tr_args("Skipped {} dropped file(s) without a local path. Use File ▸ Import ▸ File…", &[&skipped]));
|
||||
}
|
||||
|
||||
// Taken once per drop, before any early return, so a project-only drop cannot leave it set
|
||||
// for the next one (#2661).
|
||||
let handed_by_a_floating_window = std::mem::take(&mut app.forwarded.dropped_on_timeline);
|
||||
|
||||
let (proj, rest): (Vec<String>, Vec<String>) = paths.into_iter().partition(|p| {
|
||||
let l = p.to_ascii_lowercase();
|
||||
l.ends_with(".ecproj") || l.ends_with(".ecprojx")
|
||||
@@ -88,7 +92,8 @@ pub fn dropped_files(app: &mut EffectcraftApp, ui: &egui::Ui, bounds: Rect) {
|
||||
|
||||
// Dropping a file on the Timeline adds it to the composition the panel shows, as it does
|
||||
// on the viewer (#2588); the import decides the layer's position.
|
||||
let over_timeline = ctx.input(|i| i.pointer.hover_pos()).is_some_and(|p| {
|
||||
let over_timeline = handed_by_a_floating_window
|
||||
|| ctx.input(|i| i.pointer.hover_pos()).is_some_and(|p| {
|
||||
app.auto
|
||||
.elements
|
||||
.iter()
|
||||
|
||||
Reference in new issue
Block a user