diff --git a/crates/render/src/pattern.rs b/crates/render/src/pattern.rs index d1605377a..e1c7c2901 100644 --- a/crates/render/src/pattern.rs +++ b/crates/render/src/pattern.rs @@ -319,6 +319,11 @@ impl Renderer { }); } self.draw_arc(ctx, f, layer); + // The tile edge and swatch bounds are editing aids: exports and thumbnails leave them out, + // as they do guides (#3261). + if f.opts.skip_templates { + return true; + } let [r, g, b] = f.opts.tile_edge; if def.show_tile_edge { self.hairline(ctx, f, &def.tile.to_path(0.1), [r, g, b, 255]); diff --git a/crates/render/src/tests_tileedge.rs b/crates/render/src/tests_tileedge.rs index 2c487ff8f..06b27fe16 100644 --- a/crates/render/src/tests_tileedge.rs +++ b/crates/render/src/tests_tileedge.rs @@ -68,6 +68,19 @@ fn swatch_bounds_outline_the_period_dashed() { assert!((51..70).all(|x| is_white(off.pixel(x, 90)))); } +/// #3261: exports (which leave templates and guides out) don't draw the tile edge or the swatch +/// bounds, but do draw the tile's art. +#[test] +fn exports_leave_the_tile_edge_and_swatch_bounds_out() { + let d = editing(TileType::BrickByRow { offset: 0.5 }, true, true); + let opts = RenderOptions { background: Some([255; 4]), tile_edge: [0, 200, 0], skip_templates: true, ..Default::default() }; + let out = Renderer::new().render(&d, 120, 120, Affine::translate((50.5, 50.5)), &opts); + assert!(is_white(out.pixel(50, 65)), "tile edge: {:?}", out.pixel(50, 65)); + assert!((51..70).all(|x| is_white(out.pixel(x, 90))), "swatch bounds"); + let p = out.pixel(55, 55); + assert!(p[0] > 200 && p[1] < 60 && p[2] < 60, "the red square is still drawn: {p:?}"); +} + /// #1534: a path made into a guide is drawn in the guide colour and style (Preferences › Guides & /// Grid), as ruler guides are: a line, or dots with gaps between them. #[test]