diff --git a/crates/midra-layout/src/gui.rs b/crates/midra-layout/src/gui.rs index 190bc99..be76a5b 100644 --- a/crates/midra-layout/src/gui.rs +++ b/crates/midra-layout/src/gui.rs @@ -1931,23 +1931,26 @@ impl Editor { .as_ref() .map(|r| format!("Reference: {} · {} × {} px", r.name, r.size[0], r.size[1])) .unwrap_or_else(|| { - "Drop a reference picture here, or use Import / Reference image…".into() + "Drop a reference image here · Import → Reference image…".into() }), palette.muted, ) }; - ui.put( - Rect::from_min_size( - ink.point(24.0, 62.0 + extra_height), - Vec2::new(r.width() - 48.0, 52.0), - ), - egui::Label::new(egui::RichText::new(text).color(color)).wrap(), + // Size reference status to its actual text, including wrapped warnings. + let status = ui.painter().layout( + text, + FontId::proportional(12.0), + color, + (r.width() - 32.0).max(1.0), ); + let canvas_top = 64.0 + extra_height + status.size().y + 8.0; + ui.painter() + .galley(ink.point(16.0, 64.0 + extra_height), status, color); let area = Rect::from_min_max( - r.min + Vec2::new(20.0, 131.0 + extra_height), - r.max - Vec2::new(20.0, 85.0), + r.min + Vec2::new(8.0, canvas_top), + r.max - Vec2::new(8.0, 48.0), ); - let base = ((area.width() - 48.0) / sw).min((area.height() - 48.0) / sh); + let base = ((area.width() - 24.0) / sw).min((area.height() - 24.0) / sh); if self.camera_one_to_one { self.zoom = (1.0 / (base * ui.ctx().pixels_per_point())).clamp(0.0001, 256.0); self.camera_one_to_one = false; @@ -2405,7 +2408,7 @@ impl Editor { } ink.text( 24.0, - r.height() - 57.0, + r.height() - 40.0, if self.edit_content { "Crop mode · Drag crop handles to zoom content · Drag image to reposition · Click outside to finish" } else { match self.active_resize_mode() { ResizeMode::Individual => "Corners resize · Side handles keep opposite edge fixed · Shift-click selects", ResizeMode::Same => "Same handles · Matching handles scale selected layers proportionally · Escape cancels drag", @@ -2417,7 +2420,7 @@ impl Editor { ); ink.text( 24.0, - r.height() - 31.0, + r.height() - 22.0, "Scroll to zoom · Space-drag to pan · Reference image stays fixed", 12.0, palette.muted, diff --git a/crates/midra-layout/src/snapping.rs b/crates/midra-layout/src/snapping.rs index 5016c85..9e36c08 100644 --- a/crates/midra-layout/src/snapping.rs +++ b/crates/midra-layout/src/snapping.rs @@ -235,7 +235,10 @@ impl Layout { candidates.sort_by(|a, b| a.0.cmp(&b.0).then(a.1.total_cmp(&b.1))); for (priority, _, axis, target) in candidates { let mut adjusted = point; - adjusted[axis] += target - current[axis]; + // The regular preview may be pixel-rounded. Correct from the exact + // pointer geometry, or fractional viewport scales can miss the snap. + self.drag_to_with_precision(point, true); + adjusted[axis] += target - handle_point(self.layers[r.index])[axis]; if r.keep_ratio && matches!(r.handle, ResizeHandle::Corner(_)) { let original = r.before.layers[r.index]; let original_handle = handle_point(original); diff --git a/docs/midralayout/changelog.md b/docs/midralayout/changelog.md index 45a69ab..45c8921 100644 --- a/docs/midralayout/changelog.md +++ b/docs/midralayout/changelog.md @@ -4,6 +4,8 @@ ## Unreleased +- Give the canvas more space: compact reference hint/status, tighter viewport margins and footer. Warnings still wrap. Fix resize edge snapping at fractional viewport scales. + - Add center to “Measure position from”; numeric resizing preserves center offsets. Project v6 saves the reference and migrates v1–5 corners. - Rename Preferences to Settings; menu actions now read “Open all settings…”.