diff --git a/crates/ui-canvas/src/canvas/mod.rs b/crates/ui-canvas/src/canvas/mod.rs index 5aa243703..3bfe9b39e 100644 --- a/crates/ui-canvas/src/canvas/mod.rs +++ b/crates/ui-canvas/src/canvas/mod.rs @@ -388,6 +388,10 @@ impl<'a> Canvas<'a> { // As its body's scroll owner the canvas shows a control focus arrives at, and applies the page keys a focused // control leaves as its own. if let Some(by) = cx.take_reveal(area) { + eprintln!( + "DIAG command_drag_over_a_guide_moves_the_guide_with_any_tool: canvas {id:?} reveal by {by:?} in {area:?} egui focus {:?}", + ctx.memory(|memory| memory.focused()) + ); pan(&mut view, -by); jumped = true; } diff --git a/crates/ui-contract/src/contract/steps/scroll_owner.rs b/crates/ui-contract/src/contract/steps/scroll_owner.rs index 169929f7a..9b6593666 100644 --- a/crates/ui-contract/src/contract/steps/scroll_owner.rs +++ b/crates/ui-contract/src/contract/steps/scroll_owner.rs @@ -113,10 +113,11 @@ pub(crate) fn scroll_moves(ctx: &Context, owner: Id, quiet: bool) -> Vec<(NavMov /// The smallest move of `view` that shows `rect`, per axis in screen points (positive: toward larger coordinates), and /// the part of `rect` the moved view shows: what a scroll owner moves for a reveal and passes on to the scroll owner -/// around it. Along an axis the view has no extent on it moves nothing. +/// around it. Along an axis the view has no extent on it moves nothing, and along an axis `rect` spans the view on +/// it already shows all it can: a canvas control laid over the whole canvas, rulers included, moves no view inside them. pub(crate) fn reveal_move(rect: Rect, view: Rect) -> (Vec2, Rect) { let into = |low: f32, high: f32, view_low: f32, view_high: f32| { - if view_high <= view_low { + if view_high <= view_low || (low <= view_low && high >= view_high) { 0.0 } else if low < view_low { low - view_low