mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-01 09:18:07 +00:00
fix the horizontal or vertical scroll decision
This commit is contained in:
parent
c3959d056d
commit
d7af742066
1 changed files with 21 additions and 14 deletions
|
|
@ -31,27 +31,34 @@ DragHandler {
|
||||||
property int __scrollDirection: DragGestureHandler.None
|
property int __scrollDirection: DragGestureHandler.None
|
||||||
onTranslationChanged: {
|
onTranslationChanged: {
|
||||||
if (active) {
|
if (active) {
|
||||||
if (root.appDrawer.offset > PlasmaCore.Units.gridUnit) {
|
if (__scrollDirection === DragGestureHandler.None) {
|
||||||
__scrollDirection = DragGestureHandler.Vertical;
|
if (root.appDrawer.offset > PlasmaCore.Units.gridUnit) {
|
||||||
snapPage();
|
|
||||||
} else if (mainFlickable.contentX - __initialMainFlickableX > PlasmaCore.Units.gridUnit) {
|
__scrollDirection = DragGestureHandler.Vertical;
|
||||||
__scrollDirection = DragGestureHandler.Right;
|
snapPage();
|
||||||
root.appDrawer.close();
|
} else if (mainFlickable.contentX - __initialMainFlickableX > PlasmaCore.Units.gridUnit) {
|
||||||
} else if (__initialMainFlickableX - mainFlickable.contentX > PlasmaCore.Units.gridUnit) {
|
|
||||||
__scrollDirection = DragGestureHandler.Left;
|
__scrollDirection = DragGestureHandler.Right;
|
||||||
root.appDrawer.close();
|
root.appDrawer.close();
|
||||||
|
} else if (__initialMainFlickableX - mainFlickable.contentX > PlasmaCore.Units.gridUnit) {
|
||||||
|
|
||||||
|
__scrollDirection = DragGestureHandler.Left;
|
||||||
|
root.appDrawer.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__scrollDirection !== DragGestureHandler.Left || __scrollDirection !== DragGestureHandler.Right) {
|
if (__scrollDirection !== DragGestureHandler.Left && __scrollDirection !== DragGestureHandler.Right) {
|
||||||
root.appDrawer.offset = -translation.y;
|
root.appDrawer.offset = -translation.y;
|
||||||
}
|
}
|
||||||
if (__scrollDirection !== DragGestureHandler.Vertical) {
|
if (__scrollDirection !== DragGestureHandler.Vertical) {
|
||||||
let newContentX = Math.min((mainFlickable.width * mainFlickable.totalPages) - mainFlickable.width, Math.max(0, __initialMainFlickableX - translation.x));
|
let newContentX = Math.min((mainFlickable.width * mainFlickable.totalPages) - mainFlickable.width, Math.max(0, __initialMainFlickableX - translation.x));
|
||||||
|
|
||||||
if (mainFlickable.contentX < newContentX) {
|
if (__scrollDirection !== DragGestureHandler.None) {
|
||||||
__scrollDirection = DragGestureHandler.Right;
|
if (mainFlickable.contentX < newContentX) {
|
||||||
} else {
|
__scrollDirection = DragGestureHandler.Right;
|
||||||
__scrollDirection = DragGestureHandler.Left;
|
} else {
|
||||||
|
__scrollDirection = DragGestureHandler.Left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mainFlickable.contentX = newContentX;
|
mainFlickable.contentX = newContentX;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue