From b1c8a72af9f1aac83abaa05b8ce64b47d0c530ee Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Wed, 18 Nov 2026 19:23:48 +0100 Subject: [PATCH] Show preview mismatch warnings beside input controls --- crates/canvas-pilot/src/capture_ui.rs | 43 ++++++++++++++------------- crates/canvas-pilot/src/format_ui.rs | 1 + docs/canvas-pilot/changelog.md | 3 +- docs/canvas-pilot/guide/device.md | 3 +- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/crates/canvas-pilot/src/capture_ui.rs b/crates/canvas-pilot/src/capture_ui.rs index bec7d8c..64882ed 100644 --- a/crates/canvas-pilot/src/capture_ui.rs +++ b/crates/canvas-pilot/src/capture_ui.rs @@ -453,6 +453,28 @@ impl Editor { }; PreviewMismatch::compare(expected, picture) } + pub(super) fn preview_warning(&self, ui: &mut egui::Ui, i: usize) { + if let Some(mismatch) = self.preview_mismatch(i) { + let color = if mismatch.ratio { + ui.visuals().error_fg_color + } else { + theme::palette(ui.ctx()).amber + }; + let key = if mismatch.ratio { + "ui.preview-ratio-warning" + } else { + "ui.preview-size-warning" + }; + ui.colored_label(color, tr(ui.ctx(), key)); + ui.small(format!( + "{} × {} → {} × {} px", + mismatch.picture[0], + mismatch.picture[1], + mismatch.expected[0], + mismatch.expected[1] + )); + } + } pub(super) fn paint_preview_warning(&self, painter: &egui::Painter, rect: Rect, i: usize) { if self.layer_preview(i).is_none() || !self.preview_mismatch(i).is_some_and(|m| m.ratio) { return; @@ -801,26 +823,7 @@ impl Editor { if let Some(input) = changed_input { self.adapt_layer_to_input(i, input); } - if let Some(mismatch) = self.preview_mismatch(i) { - let color = if mismatch.ratio { - ui.visuals().error_fg_color - } else { - theme::palette(ui.ctx()).amber - }; - let key = if mismatch.ratio { - "ui.preview-ratio-warning" - } else { - "ui.preview-size-warning" - }; - ui.colored_label(color, tr(ui.ctx(), key)); - ui.small(format!( - "{} × {} → {} × {} px", - mismatch.picture[0], - mismatch.picture[1], - mismatch.expected[0], - mismatch.expected[1] - )); - } + self.preview_warning(ui, i); if !self.capture.error.is_empty() { ui.colored_label(ui.visuals().error_fg_color, &self.capture.error); } diff --git a/crates/canvas-pilot/src/format_ui.rs b/crates/canvas-pilot/src/format_ui.rs index 6119057..1e1cd31 100644 --- a/crates/canvas-pilot/src/format_ui.rs +++ b/crates/canvas-pilot/src/format_ui.rs @@ -346,6 +346,7 @@ impl Editor { } if self.property_tab == PropertyTab::Source { self.source_input_controls(ui,i); + self.preview_warning(ui,i); ui.separator(); ui.heading(tr(ui.ctx(), "ui.advanced-source-input-settings")); if ui.button("Open shared input settings…").clicked() { diff --git a/docs/canvas-pilot/changelog.md b/docs/canvas-pilot/changelog.md index 5133b05..0d2940b 100644 --- a/docs/canvas-pilot/changelog.md +++ b/docs/canvas-pilot/changelog.md @@ -7,7 +7,8 @@ ### v0.10.0-rc.9 - New preview controls default to Follow input. Independent preview inputs show - resolution warnings and stronger ratio warnings, including a canvas/preview + resolution warnings and stronger ratio warnings in both Source and Preview + properties, including a canvas/preview overlay. Compare processed signal dimensions, not reduced capture thumbnails; existing image framing and explicit reference-picture choices are preserved. diff --git a/docs/canvas-pilot/guide/device.md b/docs/canvas-pilot/guide/device.md index 7aef458..cd84007 100644 --- a/docs/canvas-pilot/guide/device.md +++ b/docs/canvas-pilot/guide/device.md @@ -263,7 +263,8 @@ picture before requesting a new capture. An independently selected preview with a different processed resolution shows an -amber notice. A different aspect ratio shows a stronger warning and a **Preview +amber notice in both **Source** (input selection) and **Preview** properties. +A different aspect ratio shows a stronger warning and a **Preview ratio mismatch** overlay on the canvas and Preview tab. Enable **Follow input** to match the selected source. These notices do not alter crop, fit or device routing. Reduced-resolution capture thumbnails do not trigger size warnings;