on xenial help sign in
Started to refactor the peeking-icon code.
commit928073d0555fc3dd0621dd538556675f92a280bf authorMirco Müller <mirco.mueller@ubuntu.com> dateThu 9 Jul 2015, 17:58 (11 years ago) parentccb786e
2 files changed+42−56
qml/Launcher/LauncherDelegate.qml−50 qml/Launcher/LauncherPanel.qml+42−6
qml/Launcher/LauncherDelegate.qml−50
@@ -28,7 +28,6 @@ Item {
2828 property real maxAngle: 0
2929 property bool inverted: false
3030 property bool alerting: false
31− property bool peeking: false
3231 readonly property alias wiggling: wiggleAnim.running
3332
3433 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
@@ -59,58 +58,9 @@ Item {
5958 onAlertingChanged: {
6059 if (alerting) {
6160 launcherListView.peeking(index)
62− if (launcher.state !== "visible" && launcherListView.peekingIndex === index) {
63− peeking = true
64− }
6561 } else {
6662 launcherListView.unpeeking(index)
67− peeking = false
68− }
69− }
70−
71− SequentialAnimation {
72− running: peeking
73−
74− // revealing
75− UbuntuNumberAnimation {
76− target: panel
77− property: "visible"
78− to: (launcher.visibleWidth === 0) ? 1 : 0
79− }
80−
81− UbuntuNumberAnimation {
82− alwaysRunToEnd: true
83− loops: 1
84− target: root
85− properties: "x"
86− to: units.gu(.5) + launcherListView.width * .5
87− duration: UbuntuAnimation.BriskDuration
88− }
89−
90− PauseAnimation {}
91−
92− // hiding
93− UbuntuNumberAnimation {
94− alwaysRunToEnd: true
95− loops: 1
96− target: root
97− properties: "x"
98− to: 0
99− duration: UbuntuAnimation.BriskDuration
10063 }
101−
102− UbuntuNumberAnimation {
103− target: launcherListViewItem
104− property: "clip"
105− to: 1
106− }
107−
108− UbuntuNumberAnimation {
109− target: panel
110− property: "visible"
111− to: (launcher.visibleWidth === 0) ? 0 : 1
112− }
113−
11464 }
11565
11666 QtObject {
qml/Launcher/LauncherPanel.qml+42−6
@@ -170,12 +170,6 @@ Rectangle {
170170 }
171171 }
172172
173− onPeekingIndexChanged: {
174− if (peekingIndex !== -1) {
175− launcherListViewItem.clip = false
176− }
177− }
178−
179173 // The height of the area where icons start getting folded
180174 property int foldingStartHeight: units.gu(6.5)
181175 // The height of the area where the items reach the final folding angle
@@ -232,6 +226,8 @@ Rectangle {
232226 z: -Math.abs(offset)
233227 maxAngle: 55
234228 property bool dragging: false
229+ property var peekingItem: launcherListView.peekingIndex === index ? launcherDelegate : undefined
230+
235231
236232 ThinDivider {
237233 id: dropIndicator
@@ -243,6 +239,14 @@ Rectangle {
243239 }
244240
245241 states: [
242+ State {
243+ name: "peeking"
244+ when: peekingItem === launcherDelegate && !dragging && launcher.state !== "visible"
245+ PropertyChanges {
246+ target: launcherDelegate
247+ x: units.gu(.5) + launcherListView.width * .5
248+ }
249+ },
246250 State {
247251 name: "selected"
248252 when: dndArea.selectedItem === launcherDelegate && fakeDragItem.visible && !dragging
@@ -277,6 +281,38 @@ Rectangle {
277281 ]
278282
279283 transitions: [
284+ Transition {
285+ from: ""
286+ to: "peeking"
287+ SequentialAnimation {
288+ // revealing
289+ PropertyAction { target: panel; property: "visible"; value: (launcher.visibleWidth === 0) ? 1 : 0 }
290+ PropertyAction { target: launcherListViewItem; property: "clip"; value: 0 }
291+
292+ UbuntuNumberAnimation {
293+ alwaysRunToEnd: true
294+ loops: 1
295+ target: launcherDelegate
296+ properties: "x"
297+ to: units.gu(.5) + launcherListView.width * .5
298+ duration: UbuntuAnimation.BriskDuration
299+ }
300+ PauseAnimation {}
301+
302+ // hiding
303+ UbuntuNumberAnimation {
304+ alwaysRunToEnd: true
305+ loops: 1
306+ target: launcherDelegate
307+ properties: "x"
308+ to: 0
309+ duration: UbuntuAnimation.BriskDuration
310+ }
311+
312+ PropertyAction { target: launcherListViewItem; property: "clip"; value: 1 }
313+ PropertyAction { target: panel; property: "visible"; value: (launcher.visibleWidth === 0) ? 0 : 1 }
314+ }
315+ },
280316 Transition {
281317 from: ""
282318 to: "selected"