M7: a dragged page image leaves no outline where it was

Edit text & images outlines every picture from the page's inventory,
which still has the dragged one where it was until the release; that
outline trailed behind the picture and caught up after it was let go.
Leave the dragged picture's own outline out while it moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
komo1iddin
2026-10-22 06:52:56 +08:00
co-authored by Claude Opus 5.5
parent f632c1b0ca
commit bef4e28a4d
2 changed files with 11 additions and 2 deletions
+5 -2
View File
@@ -677,14 +677,17 @@ pub(crate) fn image_input(
// hovered boxes, so a ~1000-image CAD page stays interactive in Edit text & images.
// Fully clipped placements (empty visible frames) get no outline.
let faint_all = boxes.len() <= MAX_OUTLINES;
// The picture being dragged has its frame at the pointer; its outline where it was would
// trail behind until the release.
let moving = selected.filter(|_| dragging);
if faint_all {
for b in boxes.iter().filter(|b| b.is_positive()) {
for (_, b) in boxes.iter().enumerate().filter(|(i, b)| b.is_positive() && moving != Some(*i)) {
painter.rect_stroke(*b, CornerRadius::ZERO, Stroke::new(0.75, ACCENT.gamma_multiply(0.35)), egui::StrokeKind::Outside);
}
}
let hovered_box = hover_pos.and_then(|p| boxes.iter().enumerate().rposition(|(i, b)| b.is_positive() && b.contains(p) && image_contains(i, p)));
if !faint_all {
for i in selected.into_iter().chain(hovered_box.filter(|h| Some(*h) != selected)) {
for i in selected.filter(|_| moving.is_none()).into_iter().chain(hovered_box.filter(|h| Some(*h) != selected)) {
if let Some(b) = boxes.get(i).filter(|b| b.is_positive()) {
painter.rect_stroke(*b, CornerRadius::ZERO, Stroke::new(0.75, ACCENT.gamma_multiply(0.35)), egui::StrokeKind::Outside);
}
+6
View File
@@ -4518,6 +4518,12 @@ fn a_resized_image_keeps_its_new_size_until_the_page_is_redrawn() {
h.hover_at(grip + (to - grip) * (k as f32 / 4.0));
h.run_steps(1);
}
// While dragged, no outline stays where the picture was.
let old = egui::Rect::from_two_pos(at(60.0, 40.0), at(140.0, 120.0));
let trailing = h.output().shapes.iter().any(|shape| {
matches!(&shape.shape, egui::Shape::Rect(r) if r.stroke.width == 0.75 && (r.rect.min - old.min).length() < 2.0 && (r.rect.max - old.max).length() < 2.0)
});
assert!(!trailing, "the dragged picture's outline trails behind it");
h.state_mut().views[0].hold_rasters = true;
h.drop_at(to);
for frame in 0..4 {