From f74229c64a077a2fd6abe4f1fa329ec09b9cbaeb Mon Sep 17 00:00:00 2001 From: Finn Newick Date: Fri, 23 Oct 2026 22:40:55 +0100 Subject: [PATCH] fix(ui): tile Pattern Preview copies by a size-changing preview's area MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- crates/ui-egui/src/canvas.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index e3c382b14e..811a75e703 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -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).