Skip to content

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

#1023: the eyedropper picks from the Program monitor again

NDelicd46699594287
diff --git a/crates/ui-egui/src/panels/monitor.rs b/crates/ui-egui/src/panels/monitor.rs
index 21a04dc3b..062353332 100644
--- a/crates/ui-egui/src/panels/monitor.rs
+++ b/crates/ui-egui/src/panels/monitor.rs
@@ -295,10 +295,15 @@ pub fn show(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect, which: Which)
monitor_view::zoom_pan_input(app, ui, which, video_area, pic, display_w, ppp);
}
if which == Which::Program && show_picture {
- eyedropper(app, ui, &pic_resp, pic, target, rate, time);
- crate::panels::graphics::monitor_overlay(app, ui, pic, frame_size);
- crate::panels::masks::monitor_overlay(app, ui, pic, frame_size);
- crate::panels::transform_handles::monitor_overlay(app, ui, pic, frame_size);
+ // an armed eyedropper owns clicks on the picture: the overlays would sit on top and take
+ // them (the selected clip's transform handles cover it, #1023)
+ if app.ui.eyedropper.is_some() {
+ eyedropper(app, ui, &pic_resp, pic, target, rate, time);
+ } else {
+ crate::panels::graphics::monitor_overlay(app, ui, pic, frame_size);
+ crate::panels::masks::monitor_overlay(app, ui, pic, frame_size);
+ crate::panels::transform_handles::monitor_overlay(app, ui, pic, frame_size);
+ }
}
if show_picture {
monitor_view::guides(app, ui, which, video_area, pic, frame_size);
diff --git a/crates/ui-egui/tests/scripted.rs b/crates/ui-egui/tests/scripted.rs
index b5f105c7f..33f62f53e 100644
--- a/crates/ui-egui/tests/scripted.rs
+++ b/crates/ui-egui/tests/scripted.rs
@@ -577,3 +577,26 @@ fn recording_a_shortcut_skips_the_modifier_key_presses() {
assert!(got.contains("Alt+Shift+J"), "{got}");
assert!(got.contains("Cmd+K"), "{got}");
}
+
+#[test]
+fn eyedropper_picks_a_key_color_on_a_selected_clip() {
+ // #1023: the selected clip's transform handles covered the Program picture and took the click
+ let mut d = Driver::demo();
+ let clip = track_clips(&d.sequence(), 0)[0]["clip"].clone();
+ d.exec("timeline.select", json!({"clips": [clip]}));
+ d.exec("effects.apply", json!({"effect": "Color Key"}));
+ d.ok("ui.panel.show", json!({"panel": "EffectControls"}));
+ d.frames(4);
+ let color = |d: &mut Driver| d.sequence()["video"][0]["items"][0]["effects"][0]["params"]["color"]["value"].clone();
+ let before = color(&mut d);
+ d.ok("ui.click", json!({"id": "effectControls.color_key.color.eyedropper"}));
+ d.frames(2);
+ d.ok("ui.click", json!({"id": "program.picture"}));
+ for _ in 0..200 {
+ if color(&mut d) != before {
+ break;
+ }
+ d.frames(1);
+ }
+ assert_ne!(color(&mut d), before, "the eyedropper filled Key Color from the Program picture");
+}