make the favorites slide together all the rest

This commit is contained in:
Marco Martin 2021-04-12 11:30:43 +02:00
parent 86b8269b55
commit c8078b8288
2 changed files with 16 additions and 14 deletions

View file

@ -38,7 +38,7 @@ Item {
readonly property int status: { readonly property int status: {
if (view.contentY >= -view.originY - view.height) { if (view.contentY >= -view.originY - view.height) {
return AppDrawer.Status.Open; return AppDrawer.Status.Open;
} else if (view.contentY > -view.originY - view.height*2) { } else if (view.contentY > -view.originY - view.height*2 + closedPositionOffset*2) {
return AppDrawer.Status.Peeking; return AppDrawer.Status.Peeking;
} else { } else {
return AppDrawer.Status.Closed; return AppDrawer.Status.Closed;
@ -46,6 +46,7 @@ Item {
} }
property real offset: 0 property real offset: 0
property real closedPositionOffset: 0
property real leftPadding: 0 property real leftPadding: 0
property real topPadding: 0 property real topPadding: 0
@ -63,7 +64,7 @@ Item {
property alias flickable: view property alias flickable: view
readonly property real openFactor: Math.min(1, Math.max(0, Math.min(1, (view.contentY + view.originY + view.height*2) / (units.gridUnit * 10)))) readonly property real openFactor: Math.min(1, Math.max(0, Math.min(1, (view.contentY + view.originY + view.height*2 - root.closedPositionOffset*2) / (units.gridUnit * 10))))
function open() { function open() {
if (root.status === AppDrawer.Status.Open) { if (root.status === AppDrawer.Status.Open) {
@ -76,7 +77,7 @@ Item {
function close() { function close() {
if (root.status !== AppDrawer.Status.Closed) { if (root.status !== AppDrawer.Status.Closed) {
scrollAnim.to = -view.height; scrollAnim.to = -view.height + closedPositionOffset;
scrollAnim.restart(); scrollAnim.restart();
} }
} }
@ -105,7 +106,7 @@ Item {
onOffsetChanged: { onOffsetChanged: {
if (!view.moving) { if (!view.moving) {
view.contentY = Math.max(0, offset) - view.originY - view.height*2 view.contentY = Math.max(0, offset) - view.originY - view.height*2 + closedPositionOffset*2
} }
} }
@ -151,7 +152,7 @@ Item {
color: "black" color: "black"
opacity: 0.4 * root.openFactor opacity: 0.4 * root.openFactor
height: root.height + radius * 2 height: root.height + radius * 2
y: Math.min(view.height, Math.max(-radius, -view.contentY - view.originY - root.height + root.topPadding + root.bottomPadding)) y: Math.min(view.height, Math.max(-radius, -view.contentY - view.originY - root.height + root.topPadding + root.bottomPadding + root.closedPositionOffset))
} }
Timer { Timer {
@ -175,7 +176,7 @@ Item {
} else if (root.status == AppDrawer.Status.Closed) { } else if (root.status == AppDrawer.Status.Closed) {
return 0; return 0;
} else { // peeking } else { // peeking
return (1 - view.contentY / -view.height); return root.openFactor;
} }
} }
@ -193,9 +194,9 @@ Item {
movementDirection = AppDrawer.MovementDirection.Up; movementDirection = AppDrawer.MovementDirection.Up;
} else { } else {
movementDirection = AppDrawer.MovementDirection.Down; movementDirection = AppDrawer.MovementDirection.Down;
} }return;
oldContentY = contentY; oldContentY = contentY;
root.offset = contentY + view.originY + view.height*2 root.offset = contentY + view.originY + view.height*2 //+ root.closedPositionOffset*2
MobileShell.HomeScreenControls.homeScreenPosition = contentY MobileShell.HomeScreenControls.homeScreenPosition = contentY
} }
onMovementEnded: root.snapDrawerStatus() onMovementEnded: root.snapDrawerStatus()
@ -208,12 +209,12 @@ Item {
Component.onCompleted: loadApplications() Component.onCompleted: loadApplications()
} }
header: Item { header: Rectangle {
height: root.height - root.topPadding - root.bottomPadding height: root.height - root.topPadding - root.bottomPadding - root.closedPositionOffset
property real oldHeight: height property real oldHeight: height
onHeightChanged: { onHeightChanged: {
if (root.status !== AppDrawer.Status.Open) { if (root.status !== AppDrawer.Status.Open) {
view.contentY = -view.height; view.contentY = -view.height + root.closedPositionOffset;
} }
oldHeight = height; oldHeight = height;
} }

View file

@ -102,11 +102,11 @@ FocusScope {
anchors { anchors {
fill: parent fill: parent
topMargin: plasmoid.availableScreenRect.y topMargin: plasmoid.availableScreenRect.y
bottomMargin: favoriteStrip.height + plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y bottomMargin: /*favoriteStrip.height + */plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y
} }
//TODO: favorite strip disappearing with everything else //TODO: favorite strip disappearing with everything else
//footer: favoriteStrip footer: favoriteStrip
appletsLayout: homeScreenContents.appletsLayout appletsLayout: homeScreenContents.appletsLayout
appDrawer: appDrawer appDrawer: appDrawer
@ -125,7 +125,8 @@ FocusScope {
anchors.fill: parent anchors.fill: parent
topPadding: plasmoid.availableScreenRect.y topPadding: plasmoid.availableScreenRect.y
bottomPadding: favoriteStrip.height + plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y bottomPadding: /*favoriteStrip.height +*/ plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y
closedPositionOffset: favoriteStrip.height
} }
Launcher.FavoriteStrip { Launcher.FavoriteStrip {