Commit 07f3abbe authored by Bart De Vries's avatar Bart De Vries
Browse files

Two related fixes for FooterBar to snap to bounds

- The first fix solves the issue that the FooterBar gets stuck somewhere
  in the middle when it is released when not swiping (i.e. without vertical
  velocity).
- The second fix solves the issue that happens when the window is
  resized while the FooterBar is opened.  In that case, the FooterBar
  can also get stuck being partially opened.
parent 8dba0ceb
Pipeline #61037 passed with stage
in 9 minutes and 34 seconds
......@@ -71,25 +71,40 @@ Flickable {
toClose.stop();
propagateComposedEvents = true;
}
onReleased: footerBar.resetToBounds()
onReleased: footerBar.resetToBoundsOnFlick()
}
function resetToBounds() {
if (!atYBeginning && !atYEnd) {
function resetToBoundsOnFlick() {
if (!atYBeginning || !atYEnd) {
if (footerBar.verticalVelocity > 0) {
toOpen.restart();
} else if (footerBar.verticalVelocity < 0) {
toClose.restart();
} else { // i.e. when verticalVelocity === 0
if (contentY > contentHeight / 4) {
toOpen.restart();
} else {
toClose.restart();
}
}
}
}
function resetToBoundsOnResize() {
if (contentY > contentHeight / 4) {
contentY = contentHeight / 2;
} else {
contentY = 0;
}
}
onMovementStarted: {
toOpen.stop();
toClose.stop();
}
onFlickStarted: resetToBounds()
onMovementEnded: resetToBounds()
onFlickStarted: resetToBoundsOnFlick()
onMovementEnded: resetToBoundsOnFlick()
onHeightChanged: resetToBoundsOnResize()
onImageChanged: {
if (changeBackgroundTransition.running) {
......
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