Show preview mismatch warnings beside input controls
Gitea/canvas-pilot/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-11-18 19:23:48 +01:00
parent 36f841abe5
commit b1c8a72af9
4 changed files with 28 additions and 22 deletions

View File

@ -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);
}

View File

@ -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() {

View File

@ -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.

View File

@ -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;