homescreen: Adjust swipe threshold to be more lenient for horizontal swipes

This commit is contained in:
Devin Lin 2022-01-01 21:09:10 -05:00
parent 29bbb1a178
commit f849a5fea5

View file

@ -96,7 +96,8 @@ QtObject {
property var currentSwipeState: HomeScreenState.DeterminingType property var currentSwipeState: HomeScreenState.DeterminingType
// threshold of movement in a direction before we count that as the defining SwipeState // threshold of movement in a direction before we count that as the defining SwipeState
readonly property real swipeStateDetermineThreshold: PlasmaCore.Units.smallSpacing readonly property real horizontalSwipeStateDetermineThreshold: PlasmaCore.Units.smallSpacing
readonly property real verticalSwipeStateDetermineThreshold: PlasmaCore.Units.smallSpacing * 3
// we put the offset position here when determining the swipe type, before we // we put the offset position here when determining the swipe type, before we
// transfer movement over to xPosition and yPosition // transfer movement over to xPosition and yPosition
@ -185,16 +186,16 @@ QtObject {
yDetermineSwipePosition += y; yDetermineSwipePosition += y;
// check if a swipetype can be determined and started // check if a swipetype can be determined and started
if (Math.abs(xDetermineSwipePosition) >= swipeStateDetermineThreshold) { if (Math.abs(xDetermineSwipePosition) >= horizontalSwipeStateDetermineThreshold) {
currentSwipeState = HomeScreenState.SwipingPages; currentSwipeState = HomeScreenState.SwipingPages;
xDetermineSwipePosition = 0; xDetermineSwipePosition = 0;
yDetermineSwipePosition = 0; yDetermineSwipePosition = 0;
} else if (yDetermineSwipePosition >= swipeStateDetermineThreshold) { } else if (yDetermineSwipePosition >= verticalSwipeStateDetermineThreshold) {
currentSwipeState = HomeScreenState.SwipingActionPanel; currentSwipeState = HomeScreenState.SwipingActionPanel;
MobileShell.TopPanelControls.startSwipe(); MobileShell.TopPanelControls.startSwipe();
xDetermineSwipePosition = 0; xDetermineSwipePosition = 0;
yDetermineSwipePosition = 0; yDetermineSwipePosition = 0;
} else if (-yDetermineSwipePosition >= swipeStateDetermineThreshold) { } else if (-yDetermineSwipePosition >= verticalSwipeStateDetermineThreshold) {
currentSwipeState = HomeScreenState.SwipingAppDrawerVisibility; currentSwipeState = HomeScreenState.SwipingAppDrawerVisibility;
xDetermineSwipePosition = 0; xDetermineSwipePosition = 0;
yDetermineSwipePosition = 0; yDetermineSwipePosition = 0;
@ -226,11 +227,11 @@ QtObject {
yDetermineSwipePosition += y; yDetermineSwipePosition += y;
// check if a swipetype can be determined and started // check if a swipetype can be determined and started
if (yDetermineSwipePosition >= swipeStateDetermineThreshold) { if (yDetermineSwipePosition >= verticalSwipeStateDetermineThreshold) {
currentSwipeState = HomeScreenState.SwipingAppDrawerVisibility; currentSwipeState = HomeScreenState.SwipingAppDrawerVisibility;
xDetermineSwipePosition = 0; xDetermineSwipePosition = 0;
yDetermineSwipePosition = 0; yDetermineSwipePosition = 0;
} else if (-yDetermineSwipePosition >= swipeStateDetermineThreshold) { } else if (-yDetermineSwipePosition >= verticalSwipeStateDetermineThreshold) {
currentSwipeState = HomeScreenState.SwipingAppDrawerList; currentSwipeState = HomeScreenState.SwipingAppDrawerList;
yVelocityCalculator.startMeasure(appDrawerFlickable.contentY); yVelocityCalculator.startMeasure(appDrawerFlickable.contentY);
xDetermineSwipePosition = 0; xDetermineSwipePosition = 0;