fix(ui): tile Pattern Preview copies by a size-changing preview's area

Review of #8994: with View > Pattern Preview on, the CPU canvas placed
the copies of a size-changing preview (a 90° rotation) at the
document's size, leaving gaps and overlaps. They now tile the area the
preview covers, from its origin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Finn NewickandClaude Opus 5.5 committed 2026-10-23 22:40:55 +01:00
1 parent 4df36ba4c4
commit f74229c64a
1 file changed
+10 -2
+10 -2
View File
@@ -3640,8 +3640,16 @@ pub fn canvas_view(app: &mut PhotocraftApp, ui: &mut egui::Ui, idx: usize, rect:
if let Some((detail, area)) = textures.and_then(|t| t.detail) {
paint_cpu_detail(&painter, &xf, doc.bounds(), rotated, checkerboard, detail, area);
}
for &c in &pattern {
paint_cpu_document(&painter, &pattern_xf(&xf, c, size), area, rotated, checkerboard, tex);
// Pattern Preview tiles what is shown: a size-changing preview's area, from its origin.
let (tile, copies) = if area == doc.bounds() || !app.ui.view.pattern_preview {
(size, pattern.clone())
} else {
let tile = [area.width(), area.height()];
let v = visible_doc_rect(&xf).translate(-area.x0, -area.y0);
(tile, crate::pattern_preview::copies([v.x0, v.y0, v.x1, v.y1].map(f64::from), tile))
};
for &c in &copies {
paint_cpu_document(&painter, &pattern_xf(&xf, c, tile), area, rotated, checkerboard, tex);
}
}
// Channels panel: alpha / Quick Mask overlays and single-channel views (channel_view.rs).