From 753d3d081e64c9f17e789c4c8788d84f125dd027 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 14 Nov 2026 18:33:28 +0100 Subject: [PATCH] Move input previews into a dedicated properties tab --- crates/midra-layout/src/format_ui.rs | 14 +++++++++++++- crates/midra-layout/src/gui.rs | 2 ++ docs/interfaces/midra-input-preview.md | 5 ++++- docs/midra-layout/README.md | 8 ++++---- docs/midra-layout/changelog.md | 2 ++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/crates/midra-layout/src/format_ui.rs b/crates/midra-layout/src/format_ui.rs index 332a8af..bbba639 100644 --- a/crates/midra-layout/src/format_ui.rs +++ b/crates/midra-layout/src/format_ui.rs @@ -5,6 +5,7 @@ use midra_layout::formats::{Aspect, Crop, Framing, Source}; pub(super) enum PropertyTab { Source, Mapping, + Preview, #[default] Layer, Crop, @@ -338,6 +339,7 @@ impl Editor { ui.selectable_value(&mut self.property_tab,PropertyTab::Layer,"Layer"); ui.selectable_value(&mut self.property_tab,PropertyTab::Crop,"Crop"); ui.selectable_value(&mut self.property_tab,PropertyTab::Mapping,"Mapping"); + ui.selectable_value(&mut self.property_tab,PropertyTab::Preview,"Preview"); }); ui.separator(); if self.property_tab == PropertyTab::Mapping { @@ -483,11 +485,15 @@ impl Editor { } }); if !ui.input(|input| input.pointer.primary_down()) { d.crop_before = None; } + ui.small("Crop zoom and offsets apply as you edit. Offsets stop at the content edges and adjust when zoom decreases. Undo restores earlier values."); + } + if self.property_tab == PropertyTab::Preview { + ui.heading("Input preview & crop guides"); self.crop_preview_controls(ui, i); + let current = self.layout.layers()[i]; let (_,rect)=ui.allocate_space(Vec2::new(ui.available_width(),170.0)); let preview_rect=fit_rect(rect,[current.width,current.height]); paint_source(ui.painter(),preview_rect,self.layout.formats().sources[self.layout.formats().source_for[i]],self.layout.formats().advanced[i],self.layer_preview(i)); - ui.small("Crop zoom and offsets apply as you edit. Offsets stop at the content edges and adjust when zoom decreases. Undo restores earlier values."); ui.label("Captured stills follow this layer’s input and dynamic crops. Guides are drawn above the image; screen references are separate."); } if !d.error.is_empty() {ui.colored_label(theme::palette(ui.ctx()).amber,&d.error);} @@ -1133,6 +1139,11 @@ mod tests { "Advanced source / input settings", ), ("Mapping", PropertyTab::Mapping, "Layer mapping"), + ( + "Preview", + PropertyTab::Preview, + "Input preview & crop guides", + ), ("Crop", PropertyTab::Crop, "Layer crop / zoom & position"), ( "Layer", @@ -1152,6 +1163,7 @@ mod tests { if [ "Advanced source / input settings", "Layer mapping", + "Input preview & crop guides", "Layer crop / zoom & position", "Layer resolution / final visible box", ] diff --git a/crates/midra-layout/src/gui.rs b/crates/midra-layout/src/gui.rs index cc16006..d1c640f 100644 --- a/crates/midra-layout/src/gui.rs +++ b/crates/midra-layout/src/gui.rs @@ -1731,6 +1731,7 @@ impl Editor { ("Layer properties…", PropertyTab::Layer), ("Crop properties…", PropertyTab::Crop), ("Mapping properties…", PropertyTab::Mapping), + ("Preview properties…", PropertyTab::Preview), ] { if ui.button(title).clicked() { if self.format_draft.as_ref().is_none_or(|d| !d.is_for(i)) { @@ -6846,6 +6847,7 @@ mod tests { (false, "Source properties…", PropertyTab::Source), (false, "Layer properties…", PropertyTab::Layer), (false, "Crop properties…", PropertyTab::Crop), + (false, "Preview properties…", PropertyTab::Preview), (true, "Lock selected layers", PropertyTab::Layer), ] { let mut app = Editor::default(); diff --git a/docs/interfaces/midra-input-preview.md b/docs/interfaces/midra-input-preview.md index 496972a..0059ba7 100644 --- a/docs/interfaces/midra-input-preview.md +++ b/docs/interfaces/midra-input-preview.md @@ -60,7 +60,10 @@ The source test-pattern guides paint above the image; selection borders/handles remain opaque. When the preview is hidden or absent, the slider is disabled at 100% and the original opaque pattern is used. Showing the preview again restores the chosen opacity. Outside-box content retains the existing 50% ghost treatment. -The same mapping/compositing is used in the viewport and Crop properties preview. +The same mapping/compositing is used in the viewport and the dedicated Preview +tab in Layer properties. That tab contains capture, auto-refresh, visibility and +guide-opacity controls; Crop contains geometry controls. Opening Preview does not +activate visual crop editing. The layer context menu also exposes preview controls. Layer-preview assignments, texture bytes, visibility toggles and guide opacity are not saved/exported. Add as reference remains the separate persistent path; diff --git a/docs/midra-layout/README.md b/docs/midra-layout/README.md index dcea678..1e79294 100644 --- a/docs/midra-layout/README.md +++ b/docs/midra-layout/README.md @@ -209,7 +209,7 @@ clipboard testing against a running draw.io instance remains to be done. offsets are not copied. Crop zoom is included separately as a percentage and can be toggled on paste. This is not a native WebRCS clipboard payload. -Right-click a layer for **Source properties**, **Layer properties**, **Crop properties**, +Right-click a layer for **Source properties**, **Layer properties**, **Crop properties**, **Preview properties**, **Adjust layer crop**, alignment, **Copy layer values**, **Paste layer values**, and lock/hide actions. Paste reads the clipboard and opens the existing value/mapping review before applying changes. Right-clicking a layer already in a selection keeps the whole selection and offers **Resize together**. @@ -596,9 +596,9 @@ correction still folds into exported *layer* crop; it does not configure the shared hardware input. Apply source changes commits this local model, whereas the device controls above wait for Send. -Layer properties has four tabs: **Source** for native/input resolution and input +Layer properties has five tabs: **Source** for native/input resolution and input crop, **Layer** for the final visible box, **Crop** for content zoom and offset, -and **Mapping** for the saved Midra screen/layer link. Editor input identity belongs to the opt-in **Source** tab. +**Mapping** for the saved Midra screen/layer link, and **Preview** for capture, timed refresh, preview visibility, guide opacity and the cropped image preview. Editor input identity belongs to the opt-in **Source** tab. The right-click properties entries open their matching tab directly. Mapping offers device screen/layer selectors when connected, or numeric IDs offline. Link edits apply locally immediately and support Undo. **Unmap** removes the link, @@ -1016,7 +1016,7 @@ another request waits for the old one to finish or time out (20 seconds). The returned resolution/freshness comes from the device; this is not a full-size source recording. Existing image-size/aspect warnings apply before adding. **Use for selected layer** shows the still as that layer's source content, following -input and dynamic crop/zoom. In **Crop properties**, or right-click → **Input preview +input and dynamic crop/zoom. In the **Preview** tab of Layer properties, or right-click → **Input preview & crop guides**, toggle **Show captured input** and adjust **Crop guide opacity**. Guides paint over the image, initially at 35%; without an enabled preview, guides are fully opaque and the slider is disabled. Selection handles stay fully visible. diff --git a/docs/midra-layout/changelog.md b/docs/midra-layout/changelog.md index 5eac796..298c67d 100644 --- a/docs/midra-layout/changelog.md +++ b/docs/midra-layout/changelog.md @@ -4,6 +4,8 @@ ## Unreleased +- Move captured-input controls and the image preview into a dedicated Preview properties tab, with a matching right-click entry. Crop keeps its geometry controls; the existing preview context submenu remains available. Tab-switch regression checks include Preview. + - Keep Mapping limited to Midra screen/layer links; move editor input identity into the opt-in Advanced Source section. Offer editor Inputs 1–8 independently of layer count, with New editor input for additional local identities. Apply creates missing slots and assigns the source atomically with Undo; project round-trip tests cover shared Input 8, expansion and limits. Midra layer links and physical routing remain separate. - Filter Midra destinations by each screen's CURRENT allocated layer count, not the eight firmware storage slots or physical inputs. Keep allocated layers available without assigned sources; exclude unallocated slots from import, mapping and sends, including saved links. Regression checks cover active versus staged allocation and Preview/Program sends.