Share pointer movement gate across menus

This commit is contained in:
David Heinemeier Hansson
2026-06-29 11:56:21 -05:00
parent a3f8c494e3
commit 472b5cd557
9 changed files with 163 additions and 43 deletions
+7 -14
View File
@@ -14,8 +14,6 @@ Item {
property string filterText: ""
property int selectedIndex: 0
property bool cursorActive: false
property real lastPointerX: -1
property real lastPointerY: -1
property bool clearConfirmOpen: false
property var history: []
@@ -180,21 +178,11 @@ Item {
}
function disarmPointer() {
root.lastPointerX = -1
root.lastPointerY = -1
}
function pointerMovedInCard(item, mouse) {
var point = item.mapToItem(card, mouse.x, mouse.y)
var moved = root.lastPointerX >= 0
&& (Math.abs(point.x - root.lastPointerX) > 1 || Math.abs(point.y - root.lastPointerY) > 1)
root.lastPointerX = point.x
root.lastPointerY = point.y
return moved
pointerGate.reset()
}
function selectFromPointer(index, item, mouse) {
if (!root.pointerMovedInCard(item, mouse)) return
if (!pointerGate.moved(item, mouse)) return
root.cursorActive = true
root.selectedIndex = index
}
@@ -247,6 +235,11 @@ Item {
ListModel { id: displayModel }
PointerMoveGate {
id: pointerGate
referenceItem: card
}
FileView {
id: historyFile
path: root.historyPath