From 9ed7954a9742104e8d3a6ff6bffbb23562845637 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Thu, 12 Nov 2026 19:08:18 +0530 Subject: [PATCH] #2047: markers no expression reads don't drop the resolution Compare the comp the way the frame cache does (#1083): markers count as pixels only when an expression reads them, so dragging a marker keeps Full. Tighten the click and Fast Previews Off tests so they prove the gesture reached the app. --- crates/ui-egui/src/panels/drag_preview.rs | 17 +++++++++-------- .../tests/it/ui_timeline_interacting.rs | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/panels/drag_preview.rs b/crates/ui-egui/src/panels/drag_preview.rs index 9d0d42f7b..4384095c7 100644 --- a/crates/ui-egui/src/panels/drag_preview.rs +++ b/crates/ui-egui/src/panels/drag_preview.rs @@ -8,9 +8,9 @@ use effectcraft_engine::project::{Comp, ItemId}; use crate::EffectcraftApp; -/// The frame on screen when a panel starts its pass: the active comp and its current frame. -/// [`DragWatch::end`] compares it with the frame after the panel ran its gestures, so every drag -/// the panel handles is covered without a flag per gesture. +/// The active comp and its current frame index when a panel starts its pass. [`DragWatch::end`] +/// compares them with the comp and frame after the panel ran its gestures, so every drag the +/// panel handles is covered without a flag per gesture. pub(crate) struct DragWatch { before: Option<(ItemId, Arc, i64)>, } @@ -25,10 +25,11 @@ impl DragWatch { Self { before } } - /// While the primary button drags (moved past a click), a change of the current frame or of - /// the active comp's pixels since [`Self::begin`] sets `property_interacting`, which stays - /// set until the button is up (`App::frame`). A click, a held button, or a drag that draws - /// the same pixels (scrolling, zooming, the work area, selecting) keeps Full. + /// While the primary button drags (moved past a click, or held past one), a change of the + /// current frame or of the active comp's pixels since [`Self::begin`] sets + /// `property_interacting`, which stays set until the button is up (`App::frame`). A click, + /// or a drag that draws the same pixels (scrolling, zooming, the work area, selecting, markers + /// no expression reads, as for the frame cache) keeps Full. pub(crate) fn end(self, app: &mut EffectcraftApp, ctx: &egui::Context) { let Some((id, comp, frame)) = self.before else { return }; if app.ui.viewer.property_interacting || !ctx.input(|i| i.pointer.primary_down() && i.pointer.is_decidedly_dragging()) { @@ -39,7 +40,7 @@ impl DragWatch { } let Some(now) = app.session.project.comp_arc(id) else { return }; let moved = comp.frame_rate.frame_at(app.session.time()) != frame; - if moved || (!Arc::ptr_eq(&comp, &now) && !now.same_pixels(&comp)) { + if moved || (!Arc::ptr_eq(&comp, &now) && !now.same_pixels_with(&comp, app.session.project.reads_markers(), &|_| false)) { app.ui.viewer.property_interacting = true; ctx.request_repaint(); } diff --git a/crates/ui-egui/tests/it/ui_timeline_interacting.rs b/crates/ui-egui/tests/it/ui_timeline_interacting.rs index 6ed4c719a..e2cb2112a 100644 --- a/crates/ui-egui/tests/it/ui_timeline_interacting.rs +++ b/crates/ui-egui/tests/it/ui_timeline_interacting.rs @@ -158,24 +158,42 @@ fn work_area_drag_keeps_full_resolution() { release(&mut f.h, from); } +/// Markers are pixels only to the expressions that read them (#1083): moving one keeps Full. +#[test] +fn marker_drag_keeps_full_resolution() { + let mut f = fixture("adaptive"); + f.h.state_mut().session.execute("comp.addMarker", json!({"time": 2.0})).unwrap(); + f.h.run_steps(3); + let from = rect(&f.h, "timeline.marker.0").center(); + let before = f.h.state().session.active_comp().unwrap().markers[0].time; + hold(&mut f.h, from, from + vec2(80.0, 0.0)); + assert_ne!(f.h.state().session.active_comp().unwrap().markers[0].time, before, "the marker moved"); + assert!(!draft(&f.h), "a marker no expression reads changes no pixels"); + release(&mut f.h, from); +} + #[test] fn timeline_click_keeps_full_resolution() { let mut f = fixture("adaptive"); let point = rect(&f.h, "timeline.ruler").center(); + let before = f.h.state().session.time(); f.h.input_mut().events.push(Event::PointerMoved(point)); f.h.step(); f.h.input_mut().events.push(Event::PointerButton { pos: point, button: egui::PointerButton::Primary, pressed: true, modifiers: Default::default() }); f.h.run_steps(3); + assert_ne!(f.h.state().session.time(), before, "the click moved the playhead"); assert!(!draft(&f.h)); release(&mut f.h, point); } +/// The drag is still noted, but Fast Previews Off never lowers the resolution. #[test] fn fast_previews_off_keeps_full_resolution() { let mut f = fixture("off"); let ruler = rect(&f.h, "timeline.ruler"); let from = pos2(ruler.min.x + 40.0, ruler.max.y - 3.0); hold(&mut f.h, from, from + vec2(200.0, 0.0)); + assert!(f.h.state().ui.viewer.property_interacting); assert!(!draft(&f.h)); release(&mut f.h, from); }