Handle repeated center contacts in Mini 2 swipes

This commit is contained in:
2026-11-13 11:59:14 +03:00
parent 5a23f5a1ce
commit f81e53ef85
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -18,7 +18,7 @@ const (
panelCenter = 582
panelMinTap = 18 * time.Millisecond
panelGap = 155 * time.Millisecond
panelGap = 205 * time.Millisecond
panelMaxSwipe = 520 * time.Millisecond
panelHold = 500 * time.Millisecond
panelRepeat = 250 * time.Millisecond
@@ -144,6 +144,10 @@ func (g *panelGesture) key(now time.Time, code uint16, value uint32) {
}
g.invalid = now.Before(g.cooldown)
}
// A moving finger can leave and re-enter the center zone while crossing it.
if g.count == 2 && code == panelCenter && g.path[1] == panelCenter {
return
}
if g.held || g.count == len(g.path) {
g.invalid = true
return
+3
View File
@@ -12,6 +12,9 @@ func TestPanelSwipeAndPartialSwipeAreExclusive(t *testing.T) {
}{
{[]uint16{panelMinus, panelCenter, panelPlus}, panelNext},
{[]uint16{panelPlus, panelCenter, panelMinus}, panelPrevious},
{[]uint16{panelPlus, panelCenter, panelCenter, panelMinus}, panelPrevious},
{[]uint16{panelMinus, panelCenter, panelCenter, panelPlus}, panelNext},
{[]uint16{panelPlus, panelMinus}, ""},
{[]uint16{panelMinus, panelCenter}, ""},
{[]uint16{panelMinus, panelCenter, panelMinus}, ""},
{[]uint16{panelPlus}, panelLouder},