Handle repeated center contacts in Mini 2 swipes
This commit is contained in:
+5
-1
@@ -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
|
||||
|
||||
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user