A drawing app built for agent/human collaboration
Rust
A grid of several colours lands on one new drawing past the last frame
Indicode BV4c98cbd1c8d9
diff --git a/crates/core/src/bundle.rs b/crates/core/src/bundle.rsindex 2f99f6a..92c68f2 100644--- a/crates/core/src/bundle.rs+++ b/crates/core/src/bundle.rs@@ -2167,6 +2167,39 @@ mod tests {fs::remove_dir_all(&dir).unwrap();}+ #[test]+ fn a_grid_of_several_colours_lands_on_one_new_drawing_past_the_last_frame() {+ use crate::ops::parse_lines;+ let dir = scratch("pixel-grid-frame");+ let mut bundle = Bundle::blank(+ &dir,+ &Blank {+ width: 8,+ height: 8,+ pixel: true,+ ..Blank::default()+ },+ "cli",+ )+ .unwrap();+ let layer = bundle.doc.layers[0].id.clone();+ let grid = |frame: u32| {+ format!(+ r##"{{"op":"pixel","layer":"{layer}","frame":{frame},"rows":["ab","ba"],"legend":{{"a":"#112233","b":"#aabbcc"}}}}"##+ )+ };+ bundle.apply(&parse_lines(&grid(0)).unwrap()).unwrap();+ bundle.apply(&parse_lines(&grid(3)).unwrap()).unwrap();+ let cels = bundle.doc.layers[0].cels();+ assert_eq!(+ cels.iter().map(|c| c.frame).collect::<Vec<_>>(),+ [0, 3],+ "both colours of the grid go on one drawing at frame 3"+ );+ assert_eq!(bundle.read_marks(&layer, &cels[1].id).unwrap().len(), 2);+ assert_eq!(bundle.doc.timeline.frames, 4);+ }+#[test]fn an_eraser_on_a_pixel_layer_waits_for_nothing() {use crate::fill::{Coverage, Fill};diff --git a/crates/core/src/ops.rs b/crates/core/src/ops.rsindex 418f628..297197b 100644--- a/crates/core/src/ops.rs+++ b/crates/core/src/ops.rs@@ -4525,7 +4525,10 @@ fn paint_cel_at(doc: &mut Document, layer: &str, frame: u32, out: &mut Applied)target.kind().name());}- if let Some(cel) = target.cel_at(frame).filter(|_| frame < doc.timeline.frames) {+ if let Some(cel) = target+ .cel_at(frame)+ .filter(|c| frame < doc.timeline.frames || c.frame == frame)+ {if let Some(source) = &cel.link {bail!("cel {} at frame {frame} links to {source}; paint into {source} instead",