Skip to content

Commit

Permalink
fix: windowed mode folder animation incorrect start point
Browse files Browse the repository at this point in the history
多个问题导致:

1. 文件夹的 20% 大小仍然比图标大,调到 10%
2. 之前起点是 item 的左上角,应当以图标中心为起点
3. 还需要将坐标进行一次映射

Log:
  • Loading branch information
BLumia committed Aug 5, 2024
1 parent f782d5a commit f94b923
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion qml/windowed/FreeSortListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ Item {
let idStr = model.desktopId
let strFolderId = Number(idStr.replace("internal/folders/", ""))
let strFolderName = model.display.startsWith("internal/category/") ? getCategoryName(model.display.substring(18)) : model.display
folderClicked(strFolderId, strFolderName, mapToItem(listView, 0, 0))
let offset = height / 2
folderClicked(strFolderId, strFolderName, mapToItem(listView, offset, offset))
} else {
launchApp(desktopId)
}
Expand Down
22 changes: 12 additions & 10 deletions qml/windowed/WindowedFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ InputEventItem {
folderNameFont: LauncherController.adjustFontWeight(DTK.fontManager.t6, Font.Bold)
centerPosition: Qt.point(curPointX, curPointY)

readonly property int animationDuration: 200
property int startPointX: 0
property int startPointY: 0
readonly property point endPoint: Qt.point(parent.width / 2, parent.height / 2)
Expand All @@ -193,21 +194,21 @@ InputEventItem {
enter: Transition {
ParallelAnimation {
NumberAnimation {
duration: 200
duration: folderGridViewPopup.animationDuration
properties: "scale"
easing.type: Easing.OutQuad
from: 0.2
from: 0.1
to: 1
}
NumberAnimation {
duration: 200
duration: folderGridViewPopup.animationDuration
properties: "curPointX"
easing.type: Easing.OutQuad
from: folderGridViewPopup.startPointX
to: folderGridViewPopup.endPoint.x
}
NumberAnimation {
duration: 200
duration: folderGridViewPopup.animationDuration
properties: "curPointY"
easing.type: Easing.OutQuad
from: folderGridViewPopup.startPointY
Expand All @@ -219,21 +220,21 @@ InputEventItem {
exit: Transition {
ParallelAnimation {
NumberAnimation {
duration: 200
duration: folderGridViewPopup.animationDuration
properties: "scale"
easing.type: Easing.InQuad
from: 1
to: 0.2
to: 0.1
}
NumberAnimation {
duration: 200
duration: folderGridViewPopup.animationDuration
properties: "curPointX"
easing.type: Easing.InQuad
to: folderGridViewPopup.startPointX
from: folderGridViewPopup.endPoint.x
}
NumberAnimation {
duration: 200
duration: folderGridViewPopup.animationDuration
properties: "curPointY"
easing.type: Easing.InQuad
to: folderGridViewPopup.startPointY
Expand Down Expand Up @@ -300,8 +301,9 @@ InputEventItem {
Connections {
target: appList
function onFreeSortViewFolderClicked(folderId, folderName, triggerPosition) {
folderGridViewPopup.startPointX = rowLineControl.x + rowLineControl.width / 2
folderGridViewPopup.startPointY = triggerPosition.y
let point = mapFromItem(appList, triggerPosition)
folderGridViewPopup.startPointX = point.x
folderGridViewPopup.startPointY = point.y
folderGridViewPopup.currentFolderId = folderId
folderGridViewPopup.folderName = folderName
folderGridViewPopup.open()
Expand Down

0 comments on commit f94b923

Please sign in to comment.