mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
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:
1 parent
f4cff2780c
commit
16d1bc2f1f
1 file changed
+14
-2
@@ -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)?;
|
||||
|
||||
Reference in new issue
Block a user