Commit 35674311 authored by Marco Martin's avatar Marco Martin

better behavior of the lock/unlock swipe

parent 151bdc6d
......@@ -477,6 +477,7 @@ Item {
}
property var dragData
property bool wasLocked: true
cellWidth: root.width / 4
cellHeight: root.buttonHeight
......@@ -491,21 +492,40 @@ Item {
if (draggingVertically) {
return;
}
print("AAAAAA "+contentY+" "+(-headerItem.height + root.height)+" "+(-headerItem.height + root.height/5)+wasLocked)
if (wasLocked) {
//scrolling down, unlock
if (contentY > (-headerItem.height + root.height/5)) {
scrollAnim.to = -headerItem.height +plasmoid.availableScreenRect.height
scrollAnim.running = true;
wasLocked = false;
return;
//scrolling up, lock
} else {
scrollAnim.to = -headerItem.height;
scrollAnim.running = true;
wasLocked = true;
return;
}
//manage separately the first page, the lockscreen
//scrolling down
if (verticalVelocity > 0 && contentY < -headerItem.height + root.height &&
contentY > (-headerItem.height + root.height/6)) {
scrollAnim.to = -headerItem.height +plasmoid.availableScreenRect.height
scrollAnim.running = true;
return;
//scrolling up
} else if (verticalVelocity < 0 && contentY < -headerItem.height + root.height &&
contentY < (-headerItem.height + root.height/6*5)) {
scrollAnim.to = -headerItem.height;
scrollAnim.running = true;
return;
//was unlocked
} else {
//scrolling up, lock
if (contentY < (-headerItem.height + root.height - root.height/5)) {
scrollAnim.to = -headerItem.height;
scrollAnim.running = true;
wasLocked = true;
return;
//scrolling down, unlock
} else if (contentY < (-headerItem.height + root.height + root.height/5)) {
scrollAnim.to = -headerItem.height +plasmoid.availableScreenRect.height
scrollAnim.running = true;
wasLocked = false;
return;
}
}
}
NumberAnimation {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment