mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 19:14:26 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user