Leave the pattern tile edge and swatch bounds out of exports (#3261)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
HEOJUNFO
2026-10-21 15:20:16 +07:00
committed by bflatastic
co-authored by Claude Opus 5.5
parent 97d133d9d4
commit 5569ae97a6
2 changed files with 18 additions and 0 deletions
+5
View File
@@ -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]);
+13
View File
@@ -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]