mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/halcyon: Properly implement home button trigger animations
This commit is contained in:
parent
e80408a921
commit
cb71a7779f
3 changed files with 44 additions and 6 deletions
|
|
@ -38,6 +38,16 @@ Item {
|
|||
|
||||
signal openConfigureRequested()
|
||||
|
||||
function goToBeginning() {
|
||||
goToBeginningAnim.restart();
|
||||
}
|
||||
|
||||
function closeFolder() {
|
||||
if (folderShown) {
|
||||
folderShown = false;
|
||||
}
|
||||
}
|
||||
|
||||
FavoritesGrid {
|
||||
id: favoritesGrid
|
||||
anchors.fill: parent
|
||||
|
|
@ -77,7 +87,7 @@ Item {
|
|||
twoColumn: root.twoColumn
|
||||
|
||||
onOpenConfigureRequested: root.openConfigureRequested()
|
||||
onCloseRequested: root.folderShown = false
|
||||
onCloseRequested: root.closeFolder()
|
||||
|
||||
property real translateX: 0
|
||||
transform: Translate { x: folderGrid.translateX }
|
||||
|
|
@ -85,6 +95,15 @@ Item {
|
|||
visible: opacity !== 0
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: goToBeginningAnim
|
||||
target: favoritesGrid
|
||||
properties: 'contentY'
|
||||
to: favoritesGrid.originY
|
||||
duration: 200
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: openFolderAnim
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,17 @@ MobileShell.GridView {
|
|||
|
||||
cacheBuffer: Math.max(0, rows * cellHeight)
|
||||
|
||||
function goToBeginning() {
|
||||
goToBeginningAnim.restart();
|
||||
}
|
||||
|
||||
NumberAnimation on contentY {
|
||||
id: goToBeginningAnim
|
||||
to: gridView.originY
|
||||
duration: 200
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
model: Halcyon.ApplicationListModel
|
||||
|
||||
header: MobileShell.BaseItem {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ Item {
|
|||
|
||||
function triggerHomescreen() {
|
||||
swipeView.setCurrentIndex(0);
|
||||
favoritesView.closeFolder();
|
||||
favoritesView.goToBeginning();
|
||||
gridAppList.goToBeginning();
|
||||
}
|
||||
|
||||
function openConfigure() {
|
||||
|
|
@ -53,6 +56,7 @@ Item {
|
|||
}
|
||||
|
||||
FavoritesView {
|
||||
id: favoritesView
|
||||
anchors.fill: parent
|
||||
searchWidget: root.searchWidget
|
||||
interactive: root.interactive
|
||||
|
|
@ -67,13 +71,17 @@ Item {
|
|||
|
||||
property real horizontalMargin: Math.max(Kirigami.Units.largeSpacing, root.width * 0.1 / 2)
|
||||
|
||||
GridAppList {
|
||||
interactive: root.interactive
|
||||
leftMargin: column.horizontalMargin
|
||||
rightMargin: column.horizontalMargin
|
||||
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
|
||||
QQC2.ScrollView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
GridAppList {
|
||||
id: gridAppList
|
||||
interactive: root.interactive
|
||||
leftMargin: column.horizontalMargin
|
||||
rightMargin: column.horizontalMargin
|
||||
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue