fix(qml):优化应用组收起动画

This commit is contained in:
qiqi49 2024-02-27 17:58:23 +08:00 committed by iaom
parent 07f818f3bd
commit 3252ac3bd4
5 changed files with 39 additions and 6 deletions

View File

@ -247,6 +247,7 @@ ListView {
cellWidth: width / root.column cellWidth: width / root.column
cellHeight: cellWidth cellHeight: cellWidth
interactive: false
function indexAtNullItem() { function indexAtNullItem() {
var nullItemIndex; var nullItemIndex;

View File

@ -238,6 +238,24 @@ UkuiItems.StyleBackground {
Component { Component {
id: folderIconComponent id: folderIconComponent
Item { Item {
states: [
State {
name: "iconHide"
PropertyChanges { target: folderIcon; opacity: 0 }
},
State {
name: "iconShow"
PropertyChanges { target: folderIcon; opacity: 1 }
}
]
transitions: [
Transition {
to: "iconShow"
NumberAnimation { duration: 300; easing.type: Easing.InQuint }
}
]
AppControls2.FolderIcon { AppControls2.FolderIcon {
id: folderIcon id: folderIcon
height: width height: width
@ -250,7 +268,7 @@ UkuiItems.StyleBackground {
rows: mainWindow.isFullScreen ? 4 : 2 rows: mainWindow.isFullScreen ? 4 : 2
spacing: mainWindow.isFullScreen ? 4 : 2 spacing: mainWindow.isFullScreen ? 4 : 2
padding: mainWindow.isFullScreen ? 8 : 2 padding: mainWindow.isFullScreen ? 8 : 2
radius: mainWindow.isFullScreen ? 16 :4 radius: mainWindow.isFullScreen ? Platform.Theme.maxRadius : Platform.Theme.normalRadius
} }
function itemClicked(mouseButton) { function itemClicked(mouseButton) {
if (mouseButton === Qt.RightButton) { if (mouseButton === Qt.RightButton) {
@ -260,7 +278,7 @@ UkuiItems.StyleBackground {
var y = mapToGlobal(folderIcon.x, folderIcon.y).y var y = mapToGlobal(folderIcon.x, folderIcon.y).y
openFolderSignal(id, name, x, y); openFolderSignal(id, name, x, y);
// //
opacity = 0; state = "iconHide";
control.enabled = false; control.enabled = false;
control.hoverEnabled = false; control.hoverEnabled = false;
} }
@ -270,7 +288,7 @@ UkuiItems.StyleBackground {
// folderFunction // folderFunction
function resetOpacity() { function resetOpacity() {
itemLoader.item.opacity = 1; itemLoader.item.state = "iconShow";
control.enabled = true; control.enabled = true;
control.hoverEnabled = true; control.hoverEnabled = true;
} }

View File

@ -40,6 +40,10 @@ SwipeView {
property real labelSpacing property real labelSpacing
property bool isFullScreen: false property bool isFullScreen: false
function normalScreenIconSignal() {
turnPageFinished();
}
function hideFolder() { function hideFolder() {
// //
if (currentIndex > 0) { if (currentIndex > 0) {

View File

@ -77,6 +77,7 @@ Loader {
x: (parent.width - width) / 2 x: (parent.width - width) / 2
y: 82 y: 82
alpha: 0 alpha: 0
opacity: 1
} }
PropertyChanges { PropertyChanges {
target: content target: content
@ -96,6 +97,7 @@ Loader {
x: root.mapFromGlobal(folderX, 0).x x: root.mapFromGlobal(folderX, 0).x
y: root.mapFromGlobal(0, folderY).y y: root.mapFromGlobal(0, folderY).y
alpha: 0.1 alpha: 0.1
opacity: 0
} }
PropertyChanges { PropertyChanges {
target: content target: content
@ -113,17 +115,21 @@ Loader {
ScriptAction { script: content.mouseEnable = false } ScriptAction { script: content.mouseEnable = false }
ParallelAnimation { ParallelAnimation {
PropertyAnimation { PropertyAnimation {
target: folderIconBase
duration: animationDuration; easing.type: Easing.InOutCubic duration: animationDuration; easing.type: Easing.InOutCubic
properties: "x, y, width, height, radius, alpha" properties: "x, y, width, height, radius, alpha, opacity"
} }
PropertyAnimation { PropertyAnimation {
target: folderNameText
duration: animationDuration; easing.type: Easing.OutQuint duration: animationDuration; easing.type: Easing.OutQuint
properties: "opacity" properties: "opacity"
} }
PropertyAnimation { PropertyAnimation {
target: content
duration: animationDuration; easing.type: Easing.OutQuint duration: animationDuration; easing.type: Easing.OutQuint
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins" properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
} }
ScriptAction { script: content.folderSwipeView.normalScreenIconSignal() }
} }
ScriptAction { ScriptAction {
script: { script: {
@ -141,14 +147,17 @@ Loader {
SequentialAnimation { SequentialAnimation {
ParallelAnimation { ParallelAnimation {
PropertyAnimation { PropertyAnimation {
target: folderIconBase
duration: animationDuration; easing.type: Easing.InOutCubic duration: animationDuration; easing.type: Easing.InOutCubic
properties: "x, y, width, height, radius, alpha" properties: "x, y, width, height, radius, alpha, opacity"
} }
PropertyAnimation { PropertyAnimation {
target: folderNameText
duration: animationDuration; easing.type: Easing.InQuint duration: animationDuration; easing.type: Easing.InQuint
properties: "opacity" properties: "opacity"
} }
PropertyAnimation { PropertyAnimation {
target: content
duration: animationDuration; easing.type: Easing.OutQuint duration: animationDuration; easing.type: Easing.OutQuint
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins" properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
} }
@ -162,6 +171,7 @@ Loader {
} }
} }
] ]
FolderContent { FolderContent {
id: content id: content
anchors.fill: parent anchors.fill: parent

View File

@ -98,7 +98,7 @@ Loader {
} }
PropertyChanges { PropertyChanges {
target: content target: content
contentMargins: 0 contentMargins: 8
labelSpacing: 0 labelSpacing: 0
labelMagrins: 0 labelMagrins: 0
} }