mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 20:14:31 +01:00
fw sync: L-321: the merged middle autoscroll ends on the window's blur event
The port's latch ended on PassPointer::focus_lost and a PointerGone event; upstream's MiddleAutoscroll read egui's focus flag only, which a blur event does not change in its pass. The port's addition kept on top of upstream's autoscroll (L-321).
This commit is contained in:
1 file changed
+6
-1
@@ -647,7 +647,12 @@ impl<'a> Canvas<'a> {
|
||||
let moved = 'pass: {
|
||||
if run.mark().is_some() {
|
||||
let keyed = crate::runtime::keys::keyed(&ctx);
|
||||
let unfocused = !ctx.input(|i| i.focused);
|
||||
// The window's blur reaches the pass as its event (`PassPointer::focus_lost`) before egui's focus flag
|
||||
// follows it, and a pointer gone from the window as its event: either ends the run in that pass.
|
||||
let left = crate::runtime::pointer::with_pass_pointer(&ctx, |pointer| {
|
||||
pointer.focus_lost || pointer.events.iter().any(|event| matches!(event, craft_behavior::PointerEvent::Gone))
|
||||
});
|
||||
let unfocused = left || !ctx.input(|i| i.focused);
|
||||
let off = self.navigation.middle_button != MiddleButton::AutoScroll;
|
||||
if keyed || ended || down || input.press.is_some() || unfocused || input.pos.is_none() || off {
|
||||
// Escape only stops the scroll; any other key also does its own job.
|
||||
|
||||
Reference in new issue
Block a user