From 5c81657d39007e1d3e0bf81f2afa835d7ffae356 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 14 Nov 2026 18:38:44 +0100 Subject: [PATCH] Capture input previews directly into individual layers --- crates/midra-layout/src/capture_ui.rs | 342 +++++++++++++++++++------ docs/interfaces/midra-input-preview.md | 28 +- docs/midra-layout/README.md | 57 +++-- docs/midra-layout/changelog.md | 2 + 4 files changed, 318 insertions(+), 111 deletions(-) diff --git a/crates/midra-layout/src/capture_ui.rs b/crates/midra-layout/src/capture_ui.rs index a393f76..602fb0a 100644 --- a/crates/midra-layout/src/capture_ui.rs +++ b/crates/midra-layout/src/capture_ui.rs @@ -6,13 +6,13 @@ struct LayerPreview { input: u32, host: String, source: usize, - texture: egui::TextureHandle, + texture: Option, + automatic: bool, name: String, enabled: bool, guides: f32, } struct Refresh { - enabled: bool, seconds: u64, last_input: u32, pending_input: Option, @@ -20,7 +20,6 @@ struct Refresh { impl Default for Refresh { fn default() -> Self { Self { - enabled: false, seconds: 10, last_input: 0, pending_input: None, @@ -35,6 +34,7 @@ pub(super) struct CaptureUi { layers: std::collections::BTreeMap, host: String, pending: Option, + pending_layer: Option<(usize, usize, u32, String)>, preview: Option, error: String, last_request: Option, @@ -47,19 +47,6 @@ impl CaptureUi { self.open = false; self.discard_result = true; } - fn refresh_controls(&mut self, ui: &mut egui::Ui) { - ui.checkbox(&mut self.refresh.enabled, "Auto-refresh input previews"); - ui.add_enabled( - self.refresh.enabled, - egui::Slider::new(&mut self.refresh.seconds, 5..=300) - .text("Request interval") - .suffix(" s"), - ); - ui.small("Refreshes visible layer previews in turn, one input per interval. Paused offline or while this capture window is open."); - if self.refresh.enabled && !self.error.is_empty() { - ui.colored_label(ui.visuals().error_fg_color, &self.error); - } - } fn cooling_down(&self) -> bool { self.last_request .is_some_and(|t| t.elapsed() < std::time::Duration::from_secs(5)) @@ -67,8 +54,7 @@ impl CaptureUi { } impl Editor { fn next_preview_refresh(&self) -> Option { - if !self.capture.refresh.enabled - || self.capture.open + if self.capture.open || !self.device.online() || self.capture.pending.is_some() || self @@ -92,6 +78,7 @@ impl Editor { .get(&self.layout.layer_info(i).id) .filter(|p| { p.enabled + && p.automatic && p.source == self.layout.formats().source_for[i] && p.host == self.device.host && available.iter().any(|a| a.id == p.input && a.enabled) @@ -106,6 +93,8 @@ impl Editor { .or_else(|| inputs.first().copied()) } fn start_input_capture(&mut self, ctx: &egui::Context, input: u32, automatic: bool) { + self.capture.host = self.device.host.clone(); + self.capture.pending_layer = None; self.capture.last_request = Some(std::time::Instant::now()); self.capture.discard_result = false; self.capture.error.clear(); @@ -140,59 +129,81 @@ impl Editor { .layers .get(&self.layout.layer_info(i).id) .filter(|p| p.enabled && p.source == self.layout.formats().source_for[i]) - .map(|p| (p.texture.id(), p.guides)) + .and_then(|p| p.texture.as_ref().map(|t| (t.id(), p.guides))) } pub(super) fn crop_preview_controls(&mut self, ui: &mut egui::Ui, i: usize) { let id = self.layout.layer_info(i).id; let source = self.layout.formats().source_for[i]; - if let Some(preview) = self + let inputs = self + .device + .snapshot + .as_ref() + .map(device_capture::inputs) + .unwrap_or_default(); + let online = self.device.online(); + let idle = self.capture.pending.is_none(); + let cooling = self.capture.cooling_down(); + let preview = self .capture .layers - .get_mut(&id) - .filter(|p| p.source == source) - { - ui.checkbox(&mut preview.enabled, "Show captured input"); - ui.small(&preview.name); - let mut opacity = if preview.enabled { - preview.guides * 100.0 - } else { - 100.0 - }; - if ui - .add_enabled( - preview.enabled, - egui::Slider::new(&mut opacity, 0.0..=100.0) - .text("Crop guide opacity") - .suffix("%"), - ) - .changed() - { + .entry(id) + .or_insert_with(|| LayerPreview { + input: 0, + host: self.device.host.clone(), + source, + texture: None, + name: String::new(), + enabled: false, + automatic: false, + guides: 0.35, + }); + if preview.source != source || preview.host != self.device.host { + preview.source = source; + preview.host = self.device.host.clone(); + preview.texture = None; + preview.name.clear(); + preview.automatic = false; + } + ui.checkbox(&mut preview.enabled, "Enable input preview"); + let mut capture = false; + ui.add_enabled_ui(preview.enabled, |ui| { + let before = preview.input; + egui::ComboBox::from_id_salt(("layer-preview-input", id)) + .selected_text(if preview.input == 0 { "Choose input…".into() } else { format!("Input {}", preview.input) }) + .show_ui(ui, |ui| { + for input in &inputs { + ui.selectable_value(&mut preview.input, input.id, format!("Input {}", input.id)); + } + }); + if before != preview.input { + preview.texture = None; + preview.name.clear(); + } + let available = online && inputs.iter().any(|input| input.id == preview.input && input.enabled); + capture = ui.add_enabled(available && idle && !cooling, egui::Button::new("Capture still")) + .on_hover_text("Fetch the selected input and replace this layer's preview directly.").clicked(); + ui.add_enabled(available || preview.automatic, egui::Checkbox::new(&mut preview.automatic, "Auto-refresh this preview")); + ui.add_enabled(preview.automatic, egui::Slider::new(&mut self.capture.refresh.seconds, 5..=300).text("Request interval").suffix(" s")); + ui.small("One input per interval across automatic previews; shared inputs use one request. Leave auto-refresh off to keep a still."); + let has_image = preview.enabled && preview.texture.is_some(); + let mut opacity = if has_image { preview.guides * 100.0 } else { 100.0 }; + if ui.add_enabled(has_image, egui::Slider::new(&mut opacity, 0.0..=100.0).text("Crop guide opacity").suffix("%")).changed() { preview.guides = opacity / 100.0; } - } else { - ui.add_enabled( - false, - egui::Checkbox::new(&mut false, "Show captured input"), - ); - let mut opacity = 100.0; - ui.add_enabled( - false, - egui::Slider::new(&mut opacity, 0.0..=100.0) - .text("Crop guide opacity") - .suffix("%"), - ); - ui.small("Capture a still and use it for this layer to adjust guide opacity."); + if !preview.name.is_empty() { ui.small(&preview.name); } + if !online { ui.small("Connect to Midra to choose and capture an input."); } + else if preview.input == 0 { ui.small("Choose an input, then capture a still or enable auto-refresh."); } + else if !available { ui.small("Input snapshots are unavailable. Enable snapshots in WebRCS, then refresh the connection."); } + if !idle { ui.spinner(); ui.small("Fetching an input snapshot…"); } + else if cooling { ui.small("Capture available again shortly."); ui.ctx().request_repaint_after(std::time::Duration::from_secs(1)); } + }); + if !self.capture.error.is_empty() { + ui.colored_label(ui.visuals().error_fg_color, &self.capture.error); } - self.capture.refresh_controls(ui); - if ui - .add_enabled( - self.device.online(), - egui::Button::new("Capture input preview…"), - ) - .clicked() - { - self.capture.open = true; - ui.close_menu(); + if capture { + let input = self.capture.layers[&id].input; + self.start_input_capture(ui.ctx(), input, false); + self.capture.pending_layer = Some((id, source, input, self.device.host.clone())); } } pub(super) fn capture_window(&mut self, ctx: &egui::Context) { @@ -210,19 +221,40 @@ impl Editor { if let Some(result) = result { self.capture.pending = None; let automatic = self.capture.refresh.pending_input.take(); + let direct = self.capture.pending_layer.take(); if self.capture.discard_result { self.capture.discard_result = false; } else { match result { Ok(reference) => { - if let Some(input) = automatic { - if self.capture.refresh.enabled { - for preview in - self.capture.layers.values_mut().filter(|p| { - p.input == input && p.host == self.device.host + if let Some((id, source, input, host)) = direct { + if let Some(preview) = self.capture.layers.get_mut(&id) + && preview.enabled + && preview.source == source + && preview.input == input + && preview.host == host + && (0..self.layout.layers().len()).any(|i| { + self.layout.layer_info(i).id == id + && self.layout.formats().source_for[i] == source + }) + { + preview.texture = Some(reference.texture); + preview.name = reference.name; + } + } else if let Some(input) = automatic { + for (id, preview) in &mut self.capture.layers { + if preview.enabled + && preview.automatic + && preview.input == input + && preview.host == self.device.host + && (0..self.layout.layers().len()).any(|i| { + self.layout.layer_info(i).id == *id + && self.layout.formats().source_for[i] + == preview.source }) { - preview.texture = reference.texture.clone(); + preview.texture = Some(reference.texture.clone()); + preview.name = reference.name.clone(); } } } else { @@ -237,7 +269,12 @@ impl Editor { if let Some(input) = self.next_preview_refresh() { self.start_input_capture(ctx, input, true); } - if self.capture.refresh.enabled { + if self + .capture + .layers + .values() + .any(|p| p.enabled && p.automatic) + { ctx.request_repaint_after(std::time::Duration::from_secs(1)); } if !self.capture.open { @@ -286,7 +323,7 @@ impl Editor { } }); ui.small("At most one request at a time, with at least 5 seconds between requests."); - self.capture.refresh_controls(ui); + if cooling_down { ui.small("Capture available again shortly."); ctx.request_repaint_after(std::time::Duration::from_secs(1)); } if let Some(reference) = &self.capture.preview { ui.label(format!("{} · {} × {} px", reference.name, reference.size[0], reference.size[1])); @@ -300,7 +337,10 @@ impl Editor { if !self.capture.error.is_empty() { ui.colored_label(ui.visuals().error_fg_color, &self.capture.error); } }); self.capture.open = open; - if !open { + if !open + && self.capture.pending_layer.is_none() + && self.capture.refresh.pending_input.is_none() + { self.capture.discard_result = true; } if capture { @@ -316,7 +356,8 @@ impl Editor { input: self.capture.input, host: self.device.host.clone(), source: self.layout.formats().source_for[i], - texture: reference.texture.clone(), + texture: Some(reference.texture.clone()), + automatic: false, name: reference.name.clone(), enabled: true, guides: 0.35, @@ -346,6 +387,143 @@ impl Editor { mod tests { use super::super::tests::{click_text, frame}; use super::*; + fn tiny_reference( + ctx: &egui::Context, + name: &str, + ) -> super::super::super::reference::Reference { + let mut bytes = std::io::Cursor::new(Vec::new()); + image::RgbaImage::new(2, 2) + .write_to(&mut bytes, image::ImageFormat::Png) + .unwrap(); + super::super::super::reference::Reference::load( + ctx, + &egui::DroppedFile { + name: name.into(), + bytes: Some(bytes.into_inner().into()), + ..Default::default() + }, + ) + .unwrap() + } + #[test] + fn direct_preview_workflow_replaces_only_its_layer_and_auto_can_start_empty() { + let ctx = egui::Context::default(); + let mut app = Editor::default(); + app.device.host = "127.0.0.1".into(); + app.capture.host = app.device.host.clone(); + app.device.snapshot = Some(midra_layout::device::Snapshot { + identity: "Test".into(), + screens: vec![], + raw: serde_json::json!({"device":{"inputList":{"items":{ + "INPUT_3":{"status":{"pp":{"isAvailable":true,"plug":"1"}},"snapshot":{"pp":{"enable":true}}}, + "INPUT_7":{"status":{"pp":{"isAvailable":true,"plug":"1"}},"snapshot":{"pp":{"enable":true}}} + }}}}), + }); + let i = app.layout.selected().unwrap(); + let id = app.layout.layer_info(i).id; + let source = app.layout.formats().source_for[i]; + app.format_draft = Some(FormatDraft::new(&app.layout, i)); + app.property_tab = PropertyTab::Preview; + // Hold the cooldown so UI tests never dispatch real network requests. + app.capture.last_request = Some(std::time::Instant::now()); + frame(&mut app, &ctx, vec![]); + assert!(!app.capture.layers[&id].enabled); + click_text(&mut app, &ctx, "Enable input preview"); + click_text(&mut app, &ctx, "Choose input…"); + click_text(&mut app, &ctx, "Input 3"); + assert!(app.capture.layers[&id].enabled); + assert_eq!(app.capture.layers[&id].input, 3); + assert!(app.layer_preview(i).is_none()); + let output = frame(&mut app, &ctx, vec![]); + let y = |label| { + output + .shapes + .iter() + .find_map(|s| match &s.shape { + egui::Shape::Text(t) if t.galley.text() == label => Some(t.pos.y), + _ => None, + }) + .unwrap() + }; + assert!(y("Input 3") < y("Capture still")); + assert!(y("Capture still") < y("Auto-refresh this preview")); + click_text(&mut app, &ctx, "Auto-refresh this preview"); + app.capture.last_request = None; + assert_eq!(app.next_preview_refresh(), Some(3)); // no initial still required + app.capture.last_request = Some(std::time::Instant::now()); + click_text(&mut app, &ctx, "Auto-refresh this preview"); + assert_eq!(app.next_preview_refresh(), None); + app.format_draft = None; + app.layout.select(Some(1 - i)); // completion stays bound to the original layer + let mut previous = None; + for name in ["first still", "recaptured still"] { + let (tx, rx) = std::sync::mpsc::channel(); + app.capture.pending = Some(rx); + app.capture.pending_layer = Some((id, source, 3, app.device.host.clone())); + tx.send(Ok(tiny_reference(&ctx, name))).unwrap(); + app.capture_window(&ctx); + let texture = app.layer_preview(i).unwrap().0; + assert_ne!(previous, Some(texture)); + previous = Some(texture); + assert_eq!(app.capture.layers[&id].name, name); + assert!(app.layer_preview(1 - i).is_none()); + assert!(app.capture.preview.is_none()); + assert!(app.references.is_empty()); + assert!(!app.capture.open); + } + // Changing the chosen input while a fetch is pending must reject its image. + let (tx, rx) = std::sync::mpsc::channel(); + app.capture.pending = Some(rx); + app.capture.pending_layer = Some((id, source, 3, app.device.host.clone())); + app.capture.layers.get_mut(&id).unwrap().input = 7; + tx.send(Ok(tiny_reference(&ctx, "stale input"))).unwrap(); + app.capture_window(&ctx); + assert_eq!(app.capture.layers[&id].name, "recaptured still"); + } + #[test] + fn automatic_capture_updates_only_opted_in_layers_even_when_inputs_match() { + let ctx = egui::Context::default(); + let mut app = Editor::default(); + app.device.snapshot = Some(midra_layout::device::Snapshot { + identity: "Test".into(), + screens: vec![], + raw: serde_json::json!({}), + }); + app.capture.host = app.device.host.clone(); + for i in 0..2 { + app.capture.layers.insert( + app.layout.layer_info(i).id, + LayerPreview { + input: 3, + host: app.device.host.clone(), + source: app.layout.formats().source_for[i], + texture: None, + name: String::new(), + enabled: true, + automatic: i == 0, + guides: 0.35, + }, + ); + } + let (tx, rx) = std::sync::mpsc::channel(); + app.capture.pending = Some(rx); + app.capture.refresh.pending_input = Some(3); + tx.send(Ok(tiny_reference(&ctx, "automatic first image"))) + .unwrap(); + app.capture_window(&ctx); + assert!(app.layer_preview(0).is_some()); + assert!(app.layer_preview(1).is_none()); + let id = app.layout.layer_info(0).id; + app.capture.layers.get_mut(&id).unwrap().automatic = false; + let before = app.layer_preview(0).unwrap(); + let (tx, rx) = std::sync::mpsc::channel(); + app.capture.pending = Some(rx); + app.capture.refresh.pending_input = Some(3); + tx.send(Ok(tiny_reference(&ctx, "disabled while fetching"))) + .unwrap(); + app.capture_window(&ctx); + assert_eq!(app.layer_preview(0).unwrap(), before); + } #[test] fn capture_is_manual_throttled_and_only_adds_on_request() { let ctx = egui::Context::default(); @@ -392,7 +570,9 @@ mod tests { assert!(app.references.is_empty()); // Automatic refresh is opt-in, throttled, and pauses for manual capture. assert_eq!(app.next_preview_refresh(), None); - app.capture.refresh.enabled = true; + for preview in app.capture.layers.values_mut() { + preview.automatic = true; + } assert_eq!(app.next_preview_refresh(), None); app.capture.last_request = Some(std::time::Instant::now() - std::time::Duration::from_secs(11)); @@ -427,7 +607,9 @@ mod tests { assert!(app.capture.preview.is_none()); assert!(app.references.is_empty()); assert_eq!(app.layer_preview(selected).unwrap().1, 0.35); - app.capture.refresh.enabled = false; + for preview in app.capture.layers.values_mut() { + preview.automatic = false; + } // Restore a dialog still for the separate Add as reference action. let reference = super::super::super::reference::Reference::load( &ctx, @@ -467,7 +649,9 @@ mod tests { "INPUT_7":{"status":{"pp":{"isAvailable":true,"plug":"1"}},"snapshot":{"pp":{"enable":true}}} }}}}), }); - app.capture.refresh.enabled = true; + for preview in app.capture.layers.values_mut() { + preview.automatic = true; + } for (i, input) in [3, 7].into_iter().enumerate() { app.capture.layers.insert( app.layout.layer_info(i).id, @@ -475,11 +659,12 @@ mod tests { input, host: app.device.host.clone(), source: app.layout.formats().source_for[i], - texture: ctx.load_texture( + texture: Some(ctx.load_texture( format!("Input {input}"), egui::ColorImage::new([2, 2], Color32::RED), Default::default(), - ), + )), + automatic: true, name: String::new(), enabled: true, guides: 0.35, @@ -531,7 +716,8 @@ mod tests { input: 3, host: app.device.host.clone(), source: app.layout.formats().source_for[i], - texture, + texture: Some(texture), + automatic: false, name: "Input still".into(), enabled: true, guides: 0.25, diff --git a/docs/interfaces/midra-input-preview.md b/docs/interfaces/midra-input-preview.md index 0059ba7..8b1359e 100644 --- a/docs/interfaces/midra-input-preview.md +++ b/docs/interfaces/midra-input-preview.md @@ -20,8 +20,10 @@ no proxy or redirect is followed. No immediate retries, WebSocket subscription, still-library capture or source-routing/preset writes are involved. Only one request may be in flight, with at least five seconds between starts. -Closing/cancelling discards the result but does not permit a second request until -the first completes or times out. The request has a 5-second connection timeout +Closing the separate import dialog discards its pending dialog result; cancelling +a request also discards its result. Neither permits another request until the +first completes or times out. Closing layer properties does not cancel a direct +layer capture. The request has a 5-second connection timeout and 20-second overall timeout. Device-provided resolution is retained; no request to increase resolution or refresh frequency is made. @@ -39,7 +41,8 @@ new full-resolution frame. Signal indicators may be stale until reconnect/refres The dialog displays the image and its actual pixel dimensions. **Add as reference** is explicit and obeys the 32-image/64 MiB combined-reference limits. Existing -upscale/aspect warnings apply. Capture alone does not add, replace or move anything. +upscale/aspect warnings apply. Capture in this separate import dialog only stages +an image until Use for selected layer or Add as reference is chosen. Changing device address/disconnecting invalidates the pending preview; input changes clear the old preview. A cancelled/late result cannot become a new reference. @@ -54,7 +57,17 @@ overflow while editing. It does not infer or change device routing. Changing the local input hides that assignment; opening/New/Recovery clears assignments. Reordering layers does not move an assignment to another layer. -**Show captured input** toggles this texture without discarding it. **Crop guide +In the layer Preview tab, the workflow is **Enable input preview → Input → +Capture still → Auto-refresh this preview**. Enable and auto-refresh are separate +per-layer session booleans. An enabled preview may have an input selected but no +texture yet. Capture still directly replaces only that layer's texture; repeating +it recaptures. Auto-refresh can fetch the first image without a manual capture. +The physical input picker uses available device inputs and is unrelated to the +editor input identity or Midra layer mapping. Input changes discard the old image. +Manual jobs bind to the layer's stable ID, source identity, physical input and +host at request time; selection changes do not redirect results. Changed/removed +assignments and disabled previews reject late results. Disabling a preview hides +its image and pauses requests without losing its still or chosen opacity. **Crop guide opacity** is a per-layer session value from 0–100%, initially 35% when assigned. 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 @@ -69,12 +82,13 @@ Layer-preview assignments, texture bytes, visibility toggles and guide opacity are not saved/exported. Add as reference remains the separate persistent path; generic artwork exports include those references only through the existing background option. Reloading a project makes no capture requests. -**Auto-refresh input previews** is opt-in and session-only, with a request interval +**Auto-refresh this preview** is opt-in per layer and session-only, with a shared request interval of 5–300 seconds (default 10). Assignments also retain the device address and -physical input number in memory. Visible layers with enabled previews, unchanged +physical input number in memory. Visible layers with enabled automatic previews, unchanged local inputs and the current device address are eligible; unavailable or snapshot-disabled inputs are skipped. Unique inputs refresh round-robin, one -request per interval, sharing the returned texture across their assignments. +request per interval, sharing the returned texture only across matching automatic +assignments. Manual stills are never replaced by another layer's automatic refresh. Manual and automatic capture share one worker slot and the five-second minimum. Automatic capture pauses offline, during project loading and while the capture dialog is open. Errors retain the last good image and wait for the next interval; diff --git a/docs/midra-layout/README.md b/docs/midra-layout/README.md index 1e79294..b3eaecc 100644 --- a/docs/midra-layout/README.md +++ b/docs/midra-layout/README.md @@ -1002,34 +1002,39 @@ mode only (except outline-only layers). ## Capture an input still from Midra -Connect to Midra, then choose **Import → Capture Midra input…** (also available -under the viewport context menu's **Reference images**). Choose an available input, -click **Capture still**, inspect the preview, then **Use for selected layer** or -**Add as reference**. Signal -indicators reflect the last connection refresh; an inactive input may return a -blank image. If input snapshots are disabled, enable them in WebRCS and refresh -the connection. +For a layer, open **Layer properties → Preview** (or right-click → **Input preview +& crop guides**): -Capture defaults to manual, with one request in flight -and a minimum five-second gap between requests. Cancel/close ignores the response; -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 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. -Enable **Auto-refresh input previews** here or in the capture dialog to fetch -updated stills automatically. **Request interval** defaults to 10 seconds (5–300). -Visible, enabled previews refresh one input at a time; layers sharing an input -share the image. The timer pauses offline and while the capture dialog is open. -Failed requests retain the last image. Fixed reference images never auto-refresh. -Layer previews and timer settings are session-only; no device settings are changed. +1. Check **Enable input preview**. +2. Choose the physical input to preview. This only chooses an image source; it + does not change Midra input routing or the editor's source-format identity. +3. Click **Capture still**, directly below the input selector. The image loads + straight into this layer. Click it again to replace the still. +4. Alternatively, enable **Auto-refresh this preview** below Capture. It fetches + the first image automatically and then updates it on the timer. -**Add as reference** instead creates a fixed screen guide with independent -hide/show/remove controls, embedded in saved projects. Neither action changes -source routing. See the [input preview contract](../interfaces/midra-input-preview.md). +Auto-refresh is per layer. **Request interval** is shared across automatic +previews, defaults to 10 seconds and accepts 5–300 seconds. Visible automatic +previews refresh one input at a time; automatic previews sharing an input share +one fetched image. Layers with auto-refresh off keep their manual stills. +Requests are serialized with a minimum five-second gap, including manual captures. +A failed refresh retains the last image; changing the input clears the previous +input's image. Disabling the preview hides it and pauses its refreshes. + +**Crop guide opacity** defaults to 35% with an image; without an enabled image, +guides remain fully opaque and the slider is disabled. Selection handles stay +fully visible. Layer previews and timer settings are session-only. The timer +pauses offline and while the separate capture/import dialog is open. Reduced +snapshot resolution and freshness are controlled by the device. If snapshots +are disabled for an input, enable them in WebRCS and refresh the connection. + +For fixed screen references, **Import → Capture Midra input…** opens the separate +capture dialog. Choose an input, capture and inspect the image, then **Add as +reference**. This embeds a fixed guide in the project; it never auto-refreshes. +The dialog also retains **Use for selected layer**. Existing size/aspect warnings +apply to reference images. Cancel/close discards a pending dialog capture, and +another request waits for completion or the 20-second timeout. No capture action +changes device settings or routing. See the [input preview contract](../interfaces/midra-input-preview.md). Opening a project or restoring recovery now reads, validates and decodes embedded references in a worker. The current editor stays intact until the whole project diff --git a/docs/midra-layout/changelog.md b/docs/midra-layout/changelog.md index 298c67d..c38d532 100644 --- a/docs/midra-layout/changelog.md +++ b/docs/midra-layout/changelog.md @@ -4,6 +4,8 @@ ## Unreleased +- Simplify layer previews to Enable → Input → Capture still → Auto-refresh. Capture directly replaces that layer's image; auto-refresh is per layer and can fetch the first image. Preserve serialized low-rate requests, bind manual results to their original target, and keep manual stills unchanged by other layers' refreshes. Regression tests cover control order, recapture, stale results and automatic first capture. + - 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.