fix(retouch): carry the Smudge pickup neighborhood through with_effect_on

main split LiveDab's constructor into with_effect (session) and
with_effect_on (a prepared document copy) after #7848's fix was written,
so the cherry-picked fix no longer compiled. with_effect_on keeps its
halo signature for the eraser and Pattern Stamp callers; the body moves
to with_neighborhood_on, which Smudge's live stroke reaches through
with_neighborhood.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Khawar Zamman WaniandClaude Opus 5.5 committed 2026-10-22 08:31:29 +05:30
1 parent f4cff2780c
commit 16d1bc2f1f
1 file changed
+14 -2
+14 -2
View File
@@ -1309,7 +1309,7 @@ impl LiveDab {
let st = s.active().ok_or(EngineError::NoDocument)?;
let base = (st.doc.id, st.revision);
let doc = (*st.doc).clone();
let mut live = Self::with_effect_on(doc, cmd, p, stroke, id, halo, effect)?;
let mut live = Self::with_neighborhood_on(doc, cmd, p, stroke, id, neighborhood, effect)?;
live.base = Some(base);
Ok(live)
}
@@ -1317,13 +1317,25 @@ impl LiveDab {
/// [`Self::with_effect`] on `doc`, a copy of the active document with what the commit's own
/// edit does first (the Background Eraser's Background turned into a normal layer, say).
pub(crate) fn with_effect_on(
mut doc: Document,
doc: Document,
cmd: &str,
p: &Value,
stroke: Stroke,
id: Option<LayerId>,
halo: i32,
effect: impl FnOnce(&Surface) -> DabEffect,
) -> Result<Self> {
Self::with_neighborhood_on(doc, cmd, p, stroke, id, DabNeighborhood::Halo(halo), effect)
}
fn with_neighborhood_on(
mut doc: Document,
cmd: &str,
p: &Value,
stroke: Stroke,
id: Option<LayerId>,
neighborhood: DabNeighborhood,
effect: impl FnOnce(&Surface) -> DabEffect,
) -> Result<Self> {
let sel = doc.selection.clone();
let (surf, lock) = crate::channel_cmds::target_surface(&mut doc, id, p)?;