Skip to content

Commit 738217c

Browse files
committed
feat: improve dock folder display and tooltip behavior
Improve folder item presentation and tooltip behavior in the dock. Make the new fashion mode folder interactions easier to use.
1 parent 3048b6a commit 738217c

12 files changed

Lines changed: 583 additions & 191 deletions

frame/qml/PanelToolTip.qml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,23 @@ Item {
5454
return
5555

5656
closeTimer.stop()
57+
timer.stop()
58+
59+
if (toolTipWindow.visible && toolTipWindow.currentItem && toolTipWindow.currentItem !== control) {
60+
toolTipWindow.close()
61+
toolTipWindow.currentItem = null
62+
}
63+
5764
readyBinding = Qt.binding(function () {
5865
return toolTipWindow && toolTipWindow.currentItem === control
5966
})
60-
6167
toolTipWindow.currentItem = control
6268
if (toolTipWindow.visible) {
6369
toolTipWindow.title = windowTitle
6470
if ("showAnimated" in toolTipWindow) {
6571
toolTipWindow.showAnimated()
72+
} else {
73+
toolTipWindow.show()
6674
}
6775
return
6876
}

frame/qml/PanelToolTipWindow.qml

Lines changed: 12 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,20 @@ PanelPopupWindow {
1414
D.DWindow.windowRadius: 8
1515
D.DWindow.shadowRadius: 8
1616
D.DWindow.shadowOffset: Qt.point(0, 8)
17-
property bool animatePosition: false
18-
property bool closingAnimationRequested: false
19-
property real contentScale: 1.0
20-
readonly property real hiddenContentScale: 0.96
21-
readonly property int motionDistanceLimit: 56
22-
readonly property int revealDuration: 132
23-
readonly property int dismissDuration: 108
2417

2518
function resetVisualState() {
2619
root.opacity = 1.0
27-
root.contentScale = 1.0
2820
if (root.contentItem) {
2921
root.contentItem.opacity = 1.0
22+
root.contentItem.scale = 1.0
3023
}
3124
}
3225

3326
function showAnimated() {
34-
hideAnimation.stop()
35-
closingAnimationRequested = false
36-
if (!root.visible) {
37-
root.opacity = 0.0
38-
root.contentScale = root.hiddenContentScale
39-
if (root.contentItem) {
40-
root.contentItem.opacity = 0.0
41-
}
42-
root.show()
43-
showAnimation.restart()
44-
return
45-
}
46-
4727
resetVisualState()
28+
root.positionXOffset = root.xOffset
29+
root.positionYOffset = root.yOffset
30+
root.show()
4831
}
4932

5033
function closeAnimated() {
@@ -53,146 +36,32 @@ PanelPopupWindow {
5336
return
5437
}
5538

56-
if (hideAnimation.running) {
57-
return
58-
}
59-
60-
showAnimation.stop()
61-
closingAnimationRequested = true
62-
hideAnimation.restart()
39+
root.close()
40+
root.currentItem = null
6341
}
6442

65-
function syncAnimatedPosition() {
66-
const targetX = root.xOffset
67-
const targetY = root.yOffset
68-
const delta = Math.abs(targetX - root.positionXOffset) + Math.abs(targetY - root.positionYOffset)
69-
animatePosition = root.visible && !!root.currentItem && delta > 0 && delta <= motionDistanceLimit
70-
root.positionXOffset = targetX
71-
root.positionYOffset = targetY
72-
}
43+
onXOffsetChanged: root.positionXOffset = root.xOffset
44+
onYOffsetChanged: root.positionYOffset = root.yOffset
7345

74-
onXOffsetChanged: syncAnimatedPosition()
75-
onYOffsetChanged: syncAnimatedPosition()
7646
onCurrentItemChanged: {
7747
if (!!root.currentItem && root.visible) {
48+
root.positionXOffset = root.xOffset
49+
root.positionYOffset = root.yOffset
7850
return
7951
}
8052

8153
root.positionXOffset = root.xOffset
8254
root.positionYOffset = root.yOffset
83-
animatePosition = false
8455
}
56+
8557
onVisibleChanged: {
8658
if (!visible) {
87-
animatePosition = false
8859
resetVisualState()
8960
return
9061
}
9162

9263
root.positionXOffset = root.xOffset
9364
root.positionYOffset = root.yOffset
94-
if (!showAnimation.running && !hideAnimation.running) {
95-
resetVisualState()
96-
}
97-
}
98-
99-
Binding {
100-
target: root.contentItem
101-
property: "transformOrigin"
102-
value: Item.Center
103-
}
104-
105-
Binding {
106-
target: root.contentItem
107-
property: "scale"
108-
value: root.contentScale
109-
}
110-
111-
ParallelAnimation {
112-
id: showAnimation
113-
114-
NumberAnimation {
115-
target: root
116-
property: "opacity"
117-
from: 0.0
118-
to: 1.0
119-
duration: root.revealDuration
120-
easing.type: Easing.OutCubic
121-
}
122-
123-
NumberAnimation {
124-
target: root
125-
property: "contentScale"
126-
from: root.hiddenContentScale
127-
to: 1.0
128-
duration: root.revealDuration
129-
easing.type: Easing.OutCubic
130-
}
131-
132-
NumberAnimation {
133-
target: root.contentItem
134-
property: "opacity"
135-
from: 0.0
136-
to: 1.0
137-
duration: Math.round(root.revealDuration * 0.88)
138-
easing.type: Easing.OutQuad
139-
}
140-
}
141-
142-
ParallelAnimation {
143-
id: hideAnimation
144-
145-
NumberAnimation {
146-
target: root
147-
property: "opacity"
148-
from: root.opacity
149-
to: 0.0
150-
duration: root.dismissDuration
151-
easing.type: Easing.InCubic
152-
}
153-
154-
NumberAnimation {
155-
target: root
156-
property: "contentScale"
157-
from: root.contentScale
158-
to: root.hiddenContentScale
159-
duration: root.dismissDuration
160-
easing.type: Easing.InCubic
161-
}
162-
163-
NumberAnimation {
164-
target: root.contentItem
165-
property: "opacity"
166-
from: root.contentItem ? root.contentItem.opacity : 1.0
167-
to: 0.0
168-
duration: Math.round(root.dismissDuration * 0.92)
169-
easing.type: Easing.InQuad
170-
}
171-
172-
onFinished: {
173-
if (!root.closingAnimationRequested) {
174-
return
175-
}
176-
177-
root.closingAnimationRequested = false
178-
root.close()
179-
root.currentItem = null
180-
}
181-
}
182-
183-
Behavior on positionXOffset {
184-
enabled: root.animatePosition
185-
NumberAnimation {
186-
duration: 72
187-
easing.type: Easing.OutQuad
188-
}
189-
}
190-
191-
Behavior on positionYOffset {
192-
enabled: root.animatePosition
193-
NumberAnimation {
194-
duration: 72
195-
easing.type: Easing.OutQuad
196-
}
65+
resetVisualState()
19766
}
19867
}

panels/dock/taskmanager/dconfig/org.deepin.ds.dock.taskmanager.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"visibility": "private"
8989
},
9090
"dockedElements": {
91-
"value": ["desktop/dde-file-manager", "desktop/deepin-app-store", "desktop/org.deepin.browser", "desktop/deepin-mail", "desktop/deepin-terminal", "desktop/dde-calendar", "desktop/deepin-music", "desktop/deepin-editor", "desktop/deepin-calculator", "desktop/org.deepin.dde.control-center"],
91+
"value": ["desktop/dde-file-manager", "folder/$DOWNLOADS", "folder//usr/share/applications", "desktop/deepin-app-store", "desktop/org.deepin.browser", "desktop/deepin-mail", "desktop/deepin-terminal", "desktop/dde-calendar", "desktop/deepin-music", "desktop/deepin-editor", "desktop/deepin-calculator", "desktop/org.deepin.dde.control-center"],
9292
"serial": 0,
9393
"flags": [],
9494
"name": "dockedElements",

0 commit comments

Comments
 (0)