Skip to content

Commit 20e648f

Browse files
committed
feat: add icon scaling with keyboard shortcuts
1. Added icon scaling functionality with Ctrl++/Ctrl+= to zoom in and Ctrl+- to zoom out 2. Implemented smooth scaling animation with 200ms duration and easing 3. Set scaling limits between 0.5x and 1.0x with 0.1x step increments 4. Updated IconItemDelegate to support iconScaleFactor property for consistent scaling 5. Added transformOrigin: Item.Center to maintain icon positioning during scaling feat: 添加图标缩放功能和键盘快捷键 1. 添加图标缩放功能,支持 Ctrl++/Ctrl+= 放大和 Ctrl+- 缩小 2. 实现平滑缩放动画,持续时间为200毫秒并带有缓动效果 3. 设置缩放限制在0.5倍到1.0倍之间,每次调整0.1倍 4. 更新IconItemDelegate以支持iconScaleFactor属性,确保缩放一致性 5. 添加transformOrigin: Item.Center以在缩放过程中保持图标定位 Pms: BUG-289529
1 parent fd7f19a commit 20e648f

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

qml/FullscreenFrame.qml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ InputEventItem {
1919
anchors.fill: parent
2020
objectName: "FullscreenFrame-InputEventItem"
2121

22+
property real iconScaleFactor: 1.0
23+
24+
// 缩放动画
25+
Behavior on iconScaleFactor {
26+
NumberAnimation {
27+
duration: 200
28+
easing.type: Easing.OutQuad
29+
}
30+
}
31+
2232
property Palette appTextColor: Palette {
2333
normal {
2434
common: Qt.rgba(0, 0, 0, 1)
@@ -75,6 +85,26 @@ InputEventItem {
7585
onActivatedAmbiguously: LauncherController.showHelp()
7686
}
7787

88+
Shortcut {
89+
context: Qt.ApplicationShortcut
90+
sequences: ["Ctrl++", "Ctrl+="]
91+
onActivated: {
92+
if (iconScaleFactor < 1.0) {
93+
iconScaleFactor = Math.min(iconScaleFactor + 0.1, 1.0)
94+
}
95+
}
96+
}
97+
98+
Shortcut {
99+
context: Qt.ApplicationShortcut
100+
sequences: ["Ctrl+-"]
101+
onActivated: {
102+
if (iconScaleFactor > 0.5) {
103+
iconScaleFactor = Math.max(iconScaleFactor - 0.1, 0.5)
104+
}
105+
}
106+
}
107+
78108
readonly property bool isHorizontalDock: DesktopIntegration.dockPosition === Qt.UpArrow || DesktopIntegration.dockPosition === Qt.DownArrow
79109
readonly property int dockSpacing: (isHorizontalDock ? DesktopIntegration.dockGeometry.height : DesktopIntegration.dockGeometry.width) / Screen.devicePixelRatio
80110

@@ -490,6 +520,8 @@ InputEventItem {
490520
visible: dndItem.currentlyDraggedId !== model.desktopId
491521
iconSource: (iconName && iconName !== "") ? iconName : "application-x-desktop"
492522
icons: folderIcons
523+
iconScaleFactor: baseLayer.parent.iconScaleFactor
524+
transformOrigin: Item.Center
493525
onItemClicked: {
494526
launchApp(desktopId)
495527
}
@@ -562,6 +594,8 @@ InputEventItem {
562594
width: searchResultGridViewContainer.cellWidth
563595
height: searchResultGridViewContainer.cellHeight
564596
padding: 5
597+
iconScaleFactor: baseLayer.parent.iconScaleFactor
598+
transformOrigin: Item.Center
565599
onItemClicked: {
566600
launchApp(desktopId)
567601
}

qml/IconItemDelegate.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Control {
3030
property bool dndEnabled: false
3131
readonly property bool isWindowedMode: LauncherController.currentFrame === "WindowedFrame"
3232
property alias displayFont: iconItemLabel.font
33+
property real iconScaleFactor: 1.0
3334

3435
Accessible.name: iconItemLabel.text
3536

@@ -144,7 +145,7 @@ Control {
144145

145146
name: modelData
146147
sourceSize: Qt.size(root.maxIconSizeInFolder, root.maxIconSizeInFolder)
147-
scale: parent.width / 2 / root.maxIconSizeInFolder
148+
scale: (parent.width / 2 / root.maxIconSizeInFolder) * root.iconScaleFactor
148149
palette: DTK.makeIconPalette(root.palette)
149150
theme: ApplicationHelper.DarkType
150151
}
@@ -174,7 +175,7 @@ Control {
174175
anchors.fill: parent
175176
name: iconSource
176177
sourceSize: Qt.size(root.maxIconSize, root.maxIconSize)
177-
scale: parent.width / root.maxIconSize
178+
scale: (parent.width / root.maxIconSize) * root.iconScaleFactor
178179
palette: DTK.makeIconPalette(root.palette)
179180
theme: ApplicationHelper.DarkType
180181
}

0 commit comments

Comments
 (0)