on xenial help sign in
Addressed a large chunk of suggestions from MP-comments.
commit04f0096e76a5a60de43b445202548d9cce4800a3 authorMirco Müller <mirco.mueller@canonical.com> dateTue 14 Jul 2015, 16:12 (11 years ago) parent4261c36
2 files changed+55−66
qml/Launcher/LauncherDelegate.qml+28−40 qml/Launcher/LauncherPanel.qml+27−26
qml/Launcher/LauncherDelegate.qml+28−40
@@ -41,25 +41,13 @@ Item {
4141 property real offset: 0
4242 property real itemOpacity: 1
4343 property real brightness: 0
44− property real wiggleAngle: 0
45−
46− signal alertingTriggered(int alertIndex)
47− signal alertingEnded(int alertIndex)
48−
49− onAlertingChanged: {
50− if (alerting) {
51− alertingTriggered(index)
52− } else {
53− alertingEnded(index)
54− }
55− }
44+ property double maxWiggleAngle: 5.0
5645
5746 QtObject {
58− id: privWiggleAnim
47+ id: priv
5948
60− readonly property double angle: 5.0
61− readonly property int duration: UbuntuAnimation.SnapDuration
62− readonly property var target: root
49+ readonly property int wiggleDuration: UbuntuAnimation.SnapDuration
50+ property real wiggleAngle: 0
6351 }
6452
6553 SequentialAnimation {
@@ -70,61 +58,61 @@ Item {
7058 alwaysRunToEnd: true
7159
7260 NumberAnimation {
73− target: privWiggleAnim.target
61+ target: priv
7462 property: "wiggleAngle"
7563 from: 0
76− to: privWiggleAnim.angle
77− duration: privWiggleAnim.duration
64+ to: maxWiggleAngle
65+ duration: priv.wiggleDuration
7866 easing.type: Easing.InQuad
7967 }
8068
8169 NumberAnimation {
82− target: privWiggleAnim.target
70+ target: priv
8371 property: "wiggleAngle"
84− from: privWiggleAnim.angle
85− to: -privWiggleAnim.angle
86− duration: privWiggleAnim.duration
72+ from: maxWiggleAngle
73+ to: -maxWiggleAngle
74+ duration: priv.wiggleDuration
8775 easing.type: Easing.InOutQuad
8876 }
8977
9078 NumberAnimation {
91− target: privWiggleAnim.target
79+ target: priv
9280 property: "wiggleAngle"
93− from: -privWiggleAnim.angle
94− to: privWiggleAnim.angle
95− duration: privWiggleAnim.duration
81+ from: -maxWiggleAngle
82+ to: maxWiggleAngle
83+ duration: priv.wiggleDuration
9684 easing.type: Easing.InOutQuad
9785 }
9886
9987 NumberAnimation {
100− target: privWiggleAnim.target
88+ target: priv
10189 property: "wiggleAngle"
102− from: privWiggleAnim.angle
103− to: -privWiggleAnim.angle
104− duration: privWiggleAnim.duration
90+ from: maxWiggleAngle
91+ to: -maxWiggleAngle
92+ duration: priv.wiggleDuration
10593 easing.type: Easing.InOutQuad
10694 }
10795
10896 NumberAnimation {
109− target: privWiggleAnim.target
97+ target: priv
11098 property: "wiggleAngle"
111− from: -privWiggleAnim.angle
112− to: privWiggleAnim.angle
113− duration: privWiggleAnim.duration
99+ from: -maxWiggleAngle
100+ to: maxWiggleAngle
101+ duration: priv.wiggleDuration
114102 easing.type: Easing.InOutQuad
115103 }
116104
117105 NumberAnimation {
118− target: privWiggleAnim.target
106+ target: priv
119107 property: "wiggleAngle"
120− from: privWiggleAnim.angle
108+ from: maxWiggleAngle
121109 to: 0
122− duration: privWiggleAnim.duration
110+ duration: priv.wiggleDuration
123111 easing.type: Easing.OutQuad
124112 }
125113
126114 UbuntuNumberAnimation {
127− target: privWiggleAnim.target
115+ target: root
128116 property: "alerting"
129117 to: 0
130118 }
@@ -263,7 +251,7 @@ Item {
263251 Rotation {
264252 axis { x: 0; y: 0; z: 1 }
265253 origin { x: iconItem.width / 2; y: iconItem.height / 2; z: 0 }
266− angle: root.wiggleAngle
254+ angle: priv.wiggleAngle
267255 },
268256 // Rotating 3 times at top/bottom because that increases the perspective.
269257 // This is a hack, but as QML does not support real 3D coordinates
qml/Launcher/LauncherPanel.qml+27−26
@@ -119,11 +119,11 @@ Rectangle {
119119 // need to be smaller than this size to avoid breakage.
120120 property int extensionSize: 0
121121
122− QtObject {
123− id: priv
124− property real moveToIndexYFrom
125− property real moveToIndexYTo
126− }
122+ // These properties are needed to facilitate implicitly unfolding the
123+ // launcher to the peeking icon, if it is not already fully flat
124+ // and in view for the user
125+ property real moveToIndexYFrom
126+ property real moveToIndexYTo
127127
128128 // Setting extensionSize after the list has been populated because it has
129129 // the potential to mess up with the intial positioning in combination
@@ -142,8 +142,8 @@ Rectangle {
142142 id: moveToIndexAnimation
143143 target: launcherListView
144144 property: "contentY"
145− from: priv.moveToIndexYFrom
146− to: priv.moveToIndexYTo
145+ from: launcherListView.moveToIndexYFrom
146+ to: launcherListView.moveToIndexYTo
147147 }
148148
149149 // The height of the area where icons start getting folded
@@ -202,25 +202,25 @@ Rectangle {
202202 z: -Math.abs(offset)
203203 maxAngle: 55
204204 property bool dragging: false
205− property var peekingItem: launcherListView.peekingIndex === index ? launcherDelegate : undefined
206−
207−
208− onAlertingTriggered: {
209− if (!dragging && (launcherListView.peekingIndex === -1 || launcher.visibleWidth > 0)) {
210− priv.moveToIndexYFrom = launcherListView.contentY
211− launcherListView.positionViewAtIndex(alertIndex, ListView.Center)
212− priv.moveToIndexYTo = launcherListView.contentY
213− moveToIndexAnimation.start()
214− }
215−
216− if (launcherListView.peekingIndex === -1) {
217− launcherListView.peekingIndex = alertIndex
218− }
219− }
205+ //property var peekingItem: launcherListView.peekingIndex === index ? launcherDelegate : undefined
206+ property bool peeking: launcherListView.peekingIndex === index
207+
208+ onAlertingChanged: {
209+ if(alerting) {
210+ if (!dragging && (launcherListView.peekingIndex === -1 || launcher.visibleWidth > 0)) {
211+ launcherListView.moveToIndexYFrom = launcherListView.contentY
212+ launcherListView.positionViewAtIndex(index, ListView.Center)
213+ launcherListView.moveToIndexYTo = launcherListView.contentY
214+ moveToIndexAnimation.start()
215+ }
220216
221− onAlertingEnded: {
222− if (launcherListView.peekingIndex === alertIndex) {
223− launcherListView.peekingIndex = -1
217+ if (launcherListView.peekingIndex === -1) {
218+ launcherListView.peekingIndex = index
219+ }
220+ } else {
221+ if (launcherListView.peekingIndex === index) {
222+ launcherListView.peekingIndex = -1
223+ }
224224 }
225225 }
226226
@@ -236,7 +236,8 @@ Rectangle {
236236 states: [
237237 State {
238238 name: "peeking"
239− when: peekingItem === launcherDelegate && !dragging && launcher.state !== "visible"
239+ //when: peekingItem === launcherDelegate && !dragging && launcher.state !== "visible"
240+ when: peeking && !dragging && launcher.state !== "visible"
240241 PropertyChanges {
241242 target: launcherDelegate
242243 x: (units.gu(.5) + launcherListView.width * .5) * (root.inverted ? -1 : 1)