mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Cancel sliding panel animations on touch so it's more responsive
This commit is contained in:
parent
006cb7f865
commit
f231b04bdc
2 changed files with 12 additions and 1 deletions
|
|
@ -52,14 +52,21 @@ NanoShell.FullScreenOverlay {
|
|||
}
|
||||
property int direction: SlidingPanel.MovementDirection.None
|
||||
|
||||
function cancelAnimations() {
|
||||
closeAnim.stop();
|
||||
openAnim.stop();
|
||||
}
|
||||
function open() {
|
||||
cancelAnimations();
|
||||
window.showFullScreen();
|
||||
openAnim.restart();
|
||||
}
|
||||
function close() {
|
||||
cancelAnimations();
|
||||
closeAnim.restart();
|
||||
}
|
||||
function updateState() {
|
||||
cancelAnimations();
|
||||
if (window.direction === SlidingPanel.MovementDirection.None) {
|
||||
if (offset < openThreshold) {
|
||||
close();
|
||||
|
|
@ -194,7 +201,10 @@ NanoShell.FullScreenOverlay {
|
|||
contentWidth: window.width
|
||||
contentHeight: window.height*2
|
||||
bottomMargin: window.height
|
||||
onMovementStarted: window.userInteracting = true;
|
||||
onMovementStarted: {
|
||||
window.cancelAnimations();
|
||||
window.userInteracting = true;
|
||||
}
|
||||
onFlickStarted: window.userInteracting = true;
|
||||
onMovementEnded: {
|
||||
window.userInteracting = false;
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ Item {
|
|||
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
slidingPanel.cancelAnimations();
|
||||
slidingPanel.drawerX = Math.min(Math.max(0, mouse.x - slidingPanel.drawerWidth/2), slidingPanel.width - slidingPanel.drawerWidth)
|
||||
slidingPanel.userInteracting = true;
|
||||
oldMouseY = mouse.y;
|
||||
|
|
|
|||
Loading…
Reference in a new issue