on xenial help sign in
Started to refactor the peeking-icon code.
928073dMirco Müller
qml/Launcher/LauncherDelegate.qml−50
@@ -28,7 +28,6 @@ Item {
28 property real maxAngle: 0
28 property real maxAngle: 0
29 property bool inverted: false
29 property bool inverted: false
30 property bool alerting: false
30 property bool alerting: false
31− property bool peeking: false
32 readonly property alias wiggling: wiggleAnim.running
31 readonly property alias wiggling: wiggleAnim.running
33
32
34 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
33 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
@@ -59,58 +58,9 @@ Item {
59 onAlertingChanged: {
58 onAlertingChanged: {
60 if (alerting) {
59 if (alerting) {
61 launcherListView.peeking(index)
60 launcherListView.peeking(index)
62− if (launcher.state !== "visible" && launcherListView.peekingIndex === index) {
63− peeking = true
64− }
65 } else {
61 } else {
66 launcherListView.unpeeking(index)
62 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
100 }
63 }
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−
114 }
64 }
115
65
116 QtObject {
66 QtObject {
qml/Launcher/LauncherPanel.qml+42−6
@@ -170,12 +170,6 @@ Rectangle {
170 }
170 }
171 }
171 }
172
172
173− onPeekingIndexChanged: {
174− if (peekingIndex !== -1) {
175− launcherListViewItem.clip = false
176− }
177− }
178−
179 // The height of the area where icons start getting folded
173 // The height of the area where icons start getting folded
180 property int foldingStartHeight: units.gu(6.5)
174 property int foldingStartHeight: units.gu(6.5)
181 // The height of the area where the items reach the final folding angle
175 // The height of the area where the items reach the final folding angle
@@ -232,6 +226,8 @@ Rectangle {
232 z: -Math.abs(offset)
226 z: -Math.abs(offset)
233 maxAngle: 55
227 maxAngle: 55
234 property bool dragging: false
228 property bool dragging: false
229+ property var peekingItem: launcherListView.peekingIndex === index ? launcherDelegate : undefined
230+
235
231
236 ThinDivider {
232 ThinDivider {
237 id: dropIndicator
233 id: dropIndicator
@@ -243,6 +239,14 @@ Rectangle {
243 }
239 }
244
240
245 states: [
241 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+ },
246 State {
250 State {
247 name: "selected"
251 name: "selected"
248 when: dndArea.selectedItem === launcherDelegate && fakeDragItem.visible && !dragging
252 when: dndArea.selectedItem === launcherDelegate && fakeDragItem.visible && !dragging
@@ -277,6 +281,38 @@ Rectangle {
277 ]
281 ]
278
282
279 transitions: [
283 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+ },
280 Transition {
316 Transition {
281 from: ""
317 from: ""
282 to: "selected"
318 to: "selected"