diff --git a/crates/midra-layout/src/format_ui.rs b/crates/midra-layout/src/format_ui.rs index 585cfef..ca77240 100644 --- a/crates/midra-layout/src/format_ui.rs +++ b/crates/midra-layout/src/format_ui.rs @@ -245,7 +245,9 @@ impl Editor { match self.layout.set_framing(i,d.framing) {Ok(())=>{self.sync();d.error.clear();d.framing=self.layout.formats().mapping(i,current).unwrap().framing;},Err(e)=>d.error=e} } }); - ui.checkbox(&mut self.edit_content,"Edit content by dragging inside the layer"); + if ui.add(egui::Button::new(if self.edit_content { "Done editing content" } else { "Edit content" }).selected(self.edit_content)).clicked() { + self.edit_content = !self.edit_content; + } ui.checkbox(&mut self.show_pattern,"Show source-coordinate test pattern in viewport"); let (_,rect)=ui.allocate_space(Vec2::new(ui.available_width(),170.0)); let preview_rect=fit_rect(rect,[current.width,current.height]); diff --git a/crates/midra-layout/src/gui.rs b/crates/midra-layout/src/gui.rs index c01fbbe..1823ec6 100644 --- a/crates/midra-layout/src/gui.rs +++ b/crates/midra-layout/src/gui.rs @@ -546,8 +546,10 @@ impl Editor { } } fn inspector(&mut self, ui: &mut egui::Ui) { - let (r, _) = - ui.allocate_exact_size(Vec2::new(ui.available_width(), 960.0), egui::Sense::hover()); + let (r, _) = ui.allocate_exact_size( + Vec2::new(ui.available_width(), 1008.0), + egui::Sense::hover(), + ); let ink = Ink::new(ui, r); let w = r.width(); ink.text(0.0, 2.0, "LAYERS", 11.0, MUTED); @@ -689,6 +691,17 @@ impl Editor { MUTED, ); } + let edit_label = if self.edit_content { + "Done editing content" + } else { + "Edit content" + }; + ink.button(0.0, 275.0, w, edit_label, self.edit_content); + if click(ui, &ink, [0.0, 275.0, w, 34.0], "edit-layer-content") { + self.edit_content = !self.edit_content; + } + // Leave a dedicated row for the layer's content-editing action. + let ink = Ink::new(ui, r.translate(Vec2::new(0.0, 54.0))); ink.text(0.0, 267.0, "POSITION FROM SCREEN CORNER", 11.0, MUTED); ink.card(0.0, 292.0, 94.0, 58.0, FIELD, LINE); for (x, y, c) in [ @@ -997,12 +1010,7 @@ impl Editor { "Keep aspect ratio when resizing", ), ); - if self.layout.selected().is_some() { - ui.put( - Rect::from_min_size(ink.point(350.0, 108.0), Vec2::new(240.0, 20.0)), - egui::Checkbox::new(&mut self.edit_content, "Edit content (drag to reframe)"), - ); - } else { + if self.layout.selected().is_none() { self.edit_content = false; } let (text, color) = if !self.reference_error.is_empty() { diff --git a/docs/midra-layout.md b/docs/midra-layout.md index 7cc95fb..6b6ba04 100644 --- a/docs/midra-layout.md +++ b/docs/midra-layout.md @@ -254,7 +254,9 @@ framing**: These controls operate on the applied formats. **Apply framing** is one edit; **Recenter** preserves zoom; **Reset framing** returns to the minimum centered cover crop. Invalid typed offsets show the permitted range and do not apply. -5. Enable **Edit content** to drag or arrow-nudge content inside the fixed box. +5. Click **Edit content** in the selected layer’s parameters, below its format + summary, to drag or arrow-nudge content inside the fixed box. The button + highlights while active; click **Done editing content** to leave the mode. Drags clamp at valid crop boundaries; Escape cancels a drag and leaves this mode. Wheel zoom still controls the camera. A source-coordinate test pattern illustrates framing; it is deliberately separate from the screen reference.