never close the panel when dragging

This commit is contained in:
Marco Martin 2017-09-05 13:59:20 +02:00
parent f6b68d853c
commit 49cd27ec5f
2 changed files with 19 additions and 4 deletions

View file

@ -29,6 +29,7 @@ FullScreenPanel {
property int offset: 0
property int peekHeight
property bool userInteracting: false
color: "transparent"
property alias contents: contentArea.data
@ -140,8 +141,16 @@ FullScreenPanel {
contentWidth: window.width
contentHeight: window.height*2
bottomMargin: window.height
onMovementEnded: window.updateState();
onFlickEnded: window.updateState();
onMovementStarted: window.userInteracting = true;
onFlickStarted: window.userInteracting = true;
onMovementEnded: {
window.userInteracting = false;
window.updateState();
}
onFlickEnded: {
window.userInteracting = true;
window.updateState();
}
Item {
width: window.width
height: Math.max(contentArea.height, window.height*2)
@ -153,7 +162,9 @@ FullScreenPanel {
}
height: children[0].implicitHeight
onHeightChanged: {
updateStateTimer.restart()
if (!window.userInteracting) {
updateStateTimer.restart()
}
}
}
Rectangle {

View file

@ -184,6 +184,7 @@ PlasmaCore.ColorScope {
anchors.fill: parent
onPressed: {
slidingPanel.userInteracting = true;
oldMouseY = mouse.y;
slidingPanel.visible = true;
}
@ -193,7 +194,10 @@ PlasmaCore.ColorScope {
slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY) * factor;
oldMouseY = mouse.y;
}
onReleased: slidingPanel.updateState();
onReleased: {
slidingPanel.userInteracting = false;
slidingPanel.updateState();
}
}
SlidingPanel {