mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 17:56:50 -06:00
Merge pull request #3304 from HEOJUNFO/fix/pattern-guides-in-export
Leave the pattern tile edge and swatch bounds out of exports
This commit is contained in:
@@ -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]);
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user