mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 18:04:48 +00:00
DIAG: a secondary press's winner in arenas with members, and the canvas host's momentary tool and background phase
This commit is contained in:
@@ -507,6 +507,15 @@ impl<'m> ToolHost<'m> {
|
||||
}
|
||||
// A momentary tool takes the next press anywhere on the canvas, over the session members on its body.
|
||||
pointer::withhold_members(&ctx, pass.id, momentary_tool.is_some());
|
||||
if ctx.input(|i| i.pointer.button_pressed(egui::PointerButton::Secondary) || i.pointer.button_released(egui::PointerButton::Secondary)) {
|
||||
eprintln!(
|
||||
"DIAG space_hand_view_menu_keeps_escape_and_enter_from_the_pending_crop: host {:?} momentary {:?} gesture {} background {:?}",
|
||||
pass.id,
|
||||
momentary_tool,
|
||||
state.gesture.is_some(),
|
||||
pass.press.phase
|
||||
);
|
||||
}
|
||||
// With no gesture and no momentary tool, a held stand-in key makes the stand-in the tool of hover, cursor and
|
||||
// paint while the selected tool does not take a primary press.
|
||||
let lent = if state.gesture.is_none() && momentary_tool.is_none() && !takes_primary {
|
||||
|
||||
@@ -858,8 +858,14 @@ fn outcome_in(ctx: &Context, read: &PassRead, arena: ArenaId, layer: Layer, enab
|
||||
// egui gives no click target where a drag-only widget is on top (a resize grip over a layer's or a
|
||||
// window's edge): a root under it keeps its click there, but a drag is that widget's.
|
||||
let drag_elsewhere = targets.click.is_none() && targets.drag.is_some_and(|id| !mine(Some(id)));
|
||||
resolve_press_in(state, members, xf, at, target)
|
||||
.map(|hit| (hit, if drag_elsewhere { hit.sense.difference(Sense::DRAG) } else { hit.sense }))
|
||||
let won = resolve_press_in(state, members, xf, at, target);
|
||||
if !state.previous.is_empty() && ctx.input(|i| i.pointer.button_pressed(egui::PointerButton::Secondary)) {
|
||||
eprintln!(
|
||||
"DIAG space_hand_view_menu_keeps_escape_and_enter_from_the_pending_crop: root {root:?} members {members} targets {targets:?} won {:?}",
|
||||
won.map(|hit| (hit.owner, hit.part))
|
||||
);
|
||||
}
|
||||
won.map(|hit| (hit, if drag_elsewhere { hit.sense.difference(Sense::DRAG) } else { hit.sense }))
|
||||
});
|
||||
cancelled = matches!(step.phase, Some(PressPhase::Cancel { .. }));
|
||||
release_held = machine.release_held();
|
||||
|
||||
Reference in New Issue
Block a user