drawer: the keyboard comes up on a tap, not on a press
Summoning on onPressed meant any gesture that merely began over the search field raised the keyboard — including the swipe that scrolls the app grid, which starts at the top of the drawer more often than not. The press now only remembers where it landed and the release decides, with a generous slop: a thumb reaching the top of a 540px panel is not steady, and a few pixels of drift while tapping a text field is a tap.
This commit is contained in:
parent
47e8135cdc
commit
f4caaae1cb
1 changed files with 26 additions and 1 deletions
|
|
@ -419,8 +419,33 @@ Scope {
|
|||
height: searchWidget.height
|
||||
acceptedButtons: Qt.LeftButton
|
||||
propagateComposedEvents: true
|
||||
|
||||
// A tap, not a press.
|
||||
//
|
||||
// Summoning on `onPressed` meant any gesture that merely *began*
|
||||
// over the search field raised the keyboard — including the swipe
|
||||
// that scrolls the app grid, which starts at the top of the drawer
|
||||
// more often than not. Casey, 2026-08-07: "keyboard still opens
|
||||
// when I swipe on the app drawer."
|
||||
//
|
||||
// So the press only remembers where it landed and the release
|
||||
// decides. The slop is deliberately generous: a thumb reaching the
|
||||
// top of a 540px panel is not steady, and a few pixels of drift
|
||||
// while tapping a text field is a tap.
|
||||
property real pressX: 0
|
||||
property real pressY: 0
|
||||
readonly property real tapSlop: 12
|
||||
|
||||
onPressed: (mouse) => {
|
||||
if (!GlobalStates.oskOpen) {
|
||||
oskSummoner.pressX = mouse.x;
|
||||
oskSummoner.pressY = mouse.y;
|
||||
mouse.accepted = false;
|
||||
}
|
||||
|
||||
onReleased: (mouse) => {
|
||||
const moved = Math.hypot(mouse.x - oskSummoner.pressX,
|
||||
mouse.y - oskSummoner.pressY);
|
||||
if (moved <= oskSummoner.tapSlop && !GlobalStates.oskOpen) {
|
||||
searchWidget.focusSearchInput();
|
||||
GlobalStates.oskOpen = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue