A reveal moves no view along an axis its rect already spans: a canvas-wide control under the rulers keeps the view still

DIAG: the canvas prints each reveal it takes (command_drag_over_a_guide_moves_the_guide_with_any_tool).
This commit is contained in:
aiongg
2026-11-17 05:14:47 +00:00
parent bd41b0a549
commit 7c1d7e60b6
2 changed files with 7 additions and 2 deletions
+4
View File
@@ -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;
}
@@ -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