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

View file

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