on xenial help sign in
transitions now match design
d9ef42cMichael Zanetti
Launcher/LauncherPanel.qml+44−8
@@ -117,7 +117,7 @@ Item {
117 property int draggedIndex: dndArea.draggedIndex
117 property int draggedIndex: dndArea.draggedIndex
118
118
119 displaced: Transition {
119 displaced: Transition {
120− NumberAnimation { properties: "x,y"; duration: 100 }
120+ NumberAnimation { properties: "x,y"; duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
121 }
121 }
122
122
123 delegate: LauncherListDelegate {
123 delegate: LauncherListDelegate {
@@ -137,12 +137,15 @@ Item {
137 ThinDivider {
137 ThinDivider {
138 anchors.centerIn: parent
138 anchors.centerIn: parent
139 width: parent.width + mainColumn.anchors.leftMargin + mainColumn.anchors.rightMargin
139 width: parent.width + mainColumn.anchors.leftMargin + mainColumn.anchors.rightMargin
140− visible: parent.dragging
140+ opacity: parent.dragging ? 1 : 0
141+ Behavior on opacity {
142+ NumberAnimation { duration: UbuntuAnimation.FastDuration }
143+ }
141 }
144 }
142
145
143 states: [
146 states: [
144 State {
147 State {
145− name: "pre-dragging"
148+ name: "selected"
146 when: dndArea.selectedItem === launcherDelegate && fakeDragItem.visible && !dragging
149 when: dndArea.selectedItem === launcherDelegate && fakeDragItem.visible && !dragging
147 PropertyChanges {
150 PropertyChanges {
148 target: launcherDelegate
151 target: launcherDelegate
@@ -154,27 +157,52 @@ Item {
154 when: dragging
157 when: dragging
155 PropertyChanges {
158 PropertyChanges {
156 target: launcherDelegate
159 target: launcherDelegate
157− offset: effectiveHeight / 2
160+ offset: units.gu(0.5)
158 height: units.gu(1)
161 height: units.gu(1)
159 itemOpacity: 0
162 itemOpacity: 0
160 }
163 }
161 },
164 },
162 State {
165 State {
163 name: "expanded"
166 name: "expanded"
164− when: dndArea.draggedIndex >= 0 && !dragging
167+ when: dndArea.draggedIndex >= 0 && (dndArea.preDragging || dndArea.selectedItem.dragging) && !dragging
165 PropertyChanges {
168 PropertyChanges {
166 target: launcherDelegate
169 target: launcherDelegate
167 angle: 0
170 angle: 0
168 offset: 0
171 offset: 0
172+ itemOpacity: 0.6
169 }
173 }
170 }
174 }
171
175
172 ]
176 ]
177+ onStateChanged: if (index == 5) print("state changed to", state)
173 transitions: [
178 transitions: [
179+ Transition {
180+ from: ""
181+ to: "selected"
182+ NumberAnimation { properties: "itemOpacity"; duration: UbuntuAnimation.FastDuration }
183+ },
174 Transition {
184 Transition {
175 from: "*"
185 from: "*"
186+ to: "expanded"
187+ NumberAnimation { properties: "itemOpacity"; duration: UbuntuAnimation.FastDuration }
188+ NumberAnimation { properties: "angle,offset"; duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
189+ },
190+ Transition {
191+ from: "expanded"
192+ to: ""
193+ NumberAnimation { properties: "itemOpacity"; duration: UbuntuAnimation.BriskDuration }
194+ NumberAnimation { properties: "angle,offset"; duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing }
195+ },
196+ Transition {
197+ from: "selected"
198+ to: "dragging"
199+ NumberAnimation { properties: "height"; duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
200+ },
201+ Transition {
202+ from: "dragging"
176 to: "*"
203 to: "*"
177− NumberAnimation { properties: "angle,height,itemOpacity"; duration: 150 }
204+ NumberAnimation { properties: "itemOpacity"; duration: UbuntuAnimation.BriskDuration }
205+ NumberAnimation { properties: "height"; duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing }
178 }
206 }
179 ]
207 ]
180 }
208 }
@@ -187,6 +215,7 @@ Item {
187
215
188 property int draggedIndex: -1
216 property int draggedIndex: -1
189 property var selectedItem
217 property var selectedItem
218+ property bool preDragging: false
190 property int startX
219 property int startX
191 property int startY
220 property int startY
192 property var quickListPopover
221 property var quickListPopover
@@ -228,14 +257,16 @@ Item {
228 onCanceled: {
257 onCanceled: {
229 selectedItem.highlighted = false
258 selectedItem.highlighted = false
230 selectedItem = undefined;
259 selectedItem = undefined;
260+ preDragging = false;
231 }
261 }
232
262
233 onReleased: {
263 onReleased: {
264+ draggedIndex = -1;
234 selectedItem.highlighted = false
265 selectedItem.highlighted = false
235 selectedItem.dragging = false;
266 selectedItem.dragging = false;
236 selectedItem = undefined;
267 selectedItem = undefined;
268+ preDragging = false;
237
269
238− draggedIndex = -1;
239 drag.target = undefined
270 drag.target = undefined
240
271
241 progressiveScrollingTimer.stop();
272 progressiveScrollingTimer.stop();
@@ -271,9 +302,13 @@ Item {
271
302
272 if (!selectedItem.dragging) {
303 if (!selectedItem.dragging) {
273 var distance = Math.max(Math.abs(mouseX - startX), Math.abs(mouseY - startY))
304 var distance = Math.max(Math.abs(mouseX - startX), Math.abs(mouseY - startY))
305+ if (!preDragging && distance > units.gu(1.5)) {
306+ PopupUtils.close(quickListPopover)
307+ preDragging = true;
308+ }
274 if (distance > launcherListView.itemHeight) {
309 if (distance > launcherListView.itemHeight) {
275 selectedItem.dragging = true
310 selectedItem.dragging = true
276− PopupUtils.close(quickListPopover)
311+ preDragging = false;
277 }
312 }
278 }
313 }
279 if (!selectedItem.dragging) {
314 if (!selectedItem.dragging) {
@@ -372,6 +407,7 @@ Item {
372 width: itemWidth
407 width: itemWidth
373 rotation: root.rotation
408 rotation: root.rotation
374 highlighted: true
409 highlighted: true
410+ itemOpacity: 0.8
375 }
411 }
376 }
412 }
377
413