mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-27 06:33:08 +00:00
manage the case of appDrawer not present
This commit is contained in:
parent
77291587bd
commit
fb920a3f9f
2 changed files with 21 additions and 17 deletions
|
|
@ -33,11 +33,11 @@ Flickable {
|
||||||
property Item footer
|
property Item footer
|
||||||
|
|
||||||
property alias dragGestureEnabled: gestureHandler.enabled
|
property alias dragGestureEnabled: gestureHandler.enabled
|
||||||
opacity: 1 - appDrawer.openFactor
|
opacity: appDrawer ? 1 - appDrawer.openFactor : 1
|
||||||
transform: Translate {
|
transform: Translate {
|
||||||
y: -mainFlickable.height/10 * appDrawer.openFactor
|
y: appDrawer ? -mainFlickable.height/10 * appDrawer.openFactor : 0
|
||||||
}
|
}
|
||||||
scale: (3 - appDrawer.openFactor) /3
|
scale: appDrawer ? (3 - appDrawer.openFactor) /3 : 1
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
property bool showAddPageIndicator: false
|
property bool showAddPageIndicator: false
|
||||||
|
|
|
||||||
|
|
@ -31,24 +31,26 @@ DragHandler {
|
||||||
property int __scrollDirection: DragGestureHandler.None
|
property int __scrollDirection: DragGestureHandler.None
|
||||||
onTranslationChanged: {
|
onTranslationChanged: {
|
||||||
if (active) {
|
if (active) {
|
||||||
if (__scrollDirection === DragGestureHandler.None) {
|
if (root.appDrawer) {
|
||||||
if (root.appDrawer.offset > PlasmaCore.Units.gridUnit) {
|
if (__scrollDirection === DragGestureHandler.None) {
|
||||||
|
if (root.appDrawer.offset > PlasmaCore.Units.gridUnit) {
|
||||||
|
|
||||||
__scrollDirection = DragGestureHandler.Vertical;
|
__scrollDirection = DragGestureHandler.Vertical;
|
||||||
snapPage();
|
snapPage();
|
||||||
} else if (mainFlickable.contentX - __initialMainFlickableX > PlasmaCore.Units.gridUnit) {
|
} else if (mainFlickable.contentX - __initialMainFlickableX > PlasmaCore.Units.gridUnit) {
|
||||||
|
|
||||||
__scrollDirection = DragGestureHandler.Right;
|
__scrollDirection = DragGestureHandler.Right;
|
||||||
root.appDrawer.close();
|
root.appDrawer.close();
|
||||||
} else if (__initialMainFlickableX - mainFlickable.contentX > PlasmaCore.Units.gridUnit) {
|
} else if (__initialMainFlickableX - mainFlickable.contentX > PlasmaCore.Units.gridUnit) {
|
||||||
|
|
||||||
__scrollDirection = DragGestureHandler.Left;
|
__scrollDirection = DragGestureHandler.Left;
|
||||||
root.appDrawer.close();
|
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));
|
||||||
|
|
@ -69,7 +71,9 @@ DragHandler {
|
||||||
if (active) {
|
if (active) {
|
||||||
__initialMainFlickableX = mainFlickable.contentX;
|
__initialMainFlickableX = mainFlickable.contentX;
|
||||||
} else {
|
} else {
|
||||||
root.appDrawer.snapDrawerStatus();
|
if (root.appDrawer) {
|
||||||
|
root.appDrawer.snapDrawerStatus();
|
||||||
|
}
|
||||||
if (__scrollDirection === DragGestureHandler.Left && (__initialMainFlickableX - mainFlickable.contentX > PlasmaCore.Units.gridUnit * 5)) {
|
if (__scrollDirection === DragGestureHandler.Left && (__initialMainFlickableX - mainFlickable.contentX > PlasmaCore.Units.gridUnit * 5)) {
|
||||||
snapPrevPage();
|
snapPrevPage();
|
||||||
} else if (__scrollDirection === DragGestureHandler.Right && (mainFlickable.contentX - __initialMainFlickableX > PlasmaCore.Units.gridUnit * 5)) {
|
} else if (__scrollDirection === DragGestureHandler.Right && (mainFlickable.contentX - __initialMainFlickableX > PlasmaCore.Units.gridUnit * 5)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue