Tracker: a track point can be grabbed when zoomed out (fixes #1067)

The attach point's 12 px grab area sat on top of the feature region and is tested first. Zoomed out, a default feature region is smaller than that on screen, so every press inside it moved the attach point instead of the point. Inside the feature region the attach point now grabs only the region's inner half.
This commit is contained in:
Marco Arnulfo
2026-10-12 21:22:01 +02:00
parent 470ea7a3af
commit 8e21e5dbc1
2 changed files with 55 additions and 2 deletions
+5 -2
View File
@@ -749,7 +749,11 @@ pub fn draw_overlay(app: &mut EffectcraftApp, painter: &egui::Painter, map: &Vie
let fbig = fq[0].distance(fq[2]) > 28.0;
let sbig = sq[0].distance(sq[2]) > 28.0;
let n = i + 1;
let hr = Rect::from_center_size(a, vec2(12.0, 12.0));
// Zoomed out the feature region can be smaller than the attach point's grab area: keep the
// grab to the region's inner half so the rest of it still grabs the point.
let fr = Rect::from_points(&fq);
let grab = if quad_contains(&fq, a) { 12.0f32.min(fr.width().min(fr.height()) * 0.5) } else { 12.0 };
let hr = Rect::from_center_size(a, vec2(grab, grab));
hits.push(Hit { point: n, part: Part::Attach, rect: hr, quad: None });
app.auto.add(&format!("viewer.track.{n}.attach"), hr, "Attach Point");
for (k, q) in fq.iter().enumerate() {
@@ -768,7 +772,6 @@ pub fn draw_overlay(app: &mut EffectcraftApp, painter: &egui::Painter, map: &Vie
hits.push(Hit { point: n, part: Part::SearchCorner(k), rect: r.expand(2.0), quad: None });
app.auto.add(&format!("viewer.track.{n}.search.{k}"), r, "Search region corner");
}
let fr = Rect::from_points(&fq);
let sr = Rect::from_points(&sq);
app.auto.add(&format!("viewer.track.{n}.feature"), fr, "Feature region");
app.auto.add(&format!("viewer.track.{n}.search"), sr, "Search region");