on xenial help sign in
transitions now match design
commitd9ef42ce913e78771417d27c0f2a2ec5c7101a03 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 16 Aug 2013, 00:17 (13 years ago) parentaee6183
1 file changed+44−8
Launcher/LauncherPanel.qml+44−8
Launcher/LauncherPanel.qml+44−8
@@ -117,7 +117,7 @@ Item {
117117 property int draggedIndex: dndArea.draggedIndex
118118
119119 displaced: Transition {
120− NumberAnimation { properties: "x,y"; duration: 100 }
120+ NumberAnimation { properties: "x,y"; duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
121121 }
122122
123123 delegate: LauncherListDelegate {
@@ -137,12 +137,15 @@ Item {
137137 ThinDivider {
138138 anchors.centerIn: parent
139139 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+ }
141144 }
142145
143146 states: [
144147 State {
145− name: "pre-dragging"
148+ name: "selected"
146149 when: dndArea.selectedItem === launcherDelegate && fakeDragItem.visible && !dragging
147150 PropertyChanges {
148151 target: launcherDelegate
@@ -154,27 +157,52 @@ Item {
154157 when: dragging
155158 PropertyChanges {
156159 target: launcherDelegate
157− offset: effectiveHeight / 2
160+ offset: units.gu(0.5)
158161 height: units.gu(1)
159162 itemOpacity: 0
160163 }
161164 },
162165 State {
163166 name: "expanded"
164− when: dndArea.draggedIndex >= 0 && !dragging
167+ when: dndArea.draggedIndex >= 0 && (dndArea.preDragging || dndArea.selectedItem.dragging) && !dragging
165168 PropertyChanges {
166169 target: launcherDelegate
167170 angle: 0
168171 offset: 0
172+ itemOpacity: 0.6
169173 }
170174 }
171175
172176 ]
177+ onStateChanged: if (index == 5) print("state changed to", state)
173178 transitions: [
179+ Transition {
180+ from: ""
181+ to: "selected"
182+ NumberAnimation { properties: "itemOpacity"; duration: UbuntuAnimation.FastDuration }
183+ },
174184 Transition {
175185 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"
176203 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 }
178206 }
179207 ]
180208 }
@@ -187,6 +215,7 @@ Item {
187215
188216 property int draggedIndex: -1
189217 property var selectedItem
218+ property bool preDragging: false
190219 property int startX
191220 property int startY
192221 property var quickListPopover
@@ -228,14 +257,16 @@ Item {
228257 onCanceled: {
229258 selectedItem.highlighted = false
230259 selectedItem = undefined;
260+ preDragging = false;
231261 }
232262
233263 onReleased: {
264+ draggedIndex = -1;
234265 selectedItem.highlighted = false
235266 selectedItem.dragging = false;
236267 selectedItem = undefined;
268+ preDragging = false;
237269
238− draggedIndex = -1;
239270 drag.target = undefined
240271
241272 progressiveScrollingTimer.stop();
@@ -271,9 +302,13 @@ Item {
271302
272303 if (!selectedItem.dragging) {
273304 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+ }
274309 if (distance > launcherListView.itemHeight) {
275310 selectedItem.dragging = true
276− PopupUtils.close(quickListPopover)
311+ preDragging = false;
277312 }
278313 }
279314 if (!selectedItem.dragging) {
@@ -372,6 +407,7 @@ Item {
372407 width: itemWidth
373408 rotation: root.rotation
374409 highlighted: true
410+ itemOpacity: 0.8
375411 }
376412 }
377413