on xenial help sign in
dnd seems to do quite well now :)
commit8493506b801df9768bffd1c3e8c1feaa4e2f3f56 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 15 Aug 2013, 15:14 (13 years ago) parentd441dd6
2 files changed+47−17
Launcher/LauncherPanel.qml+37−17 plugins/Unity/Launcher/backend/launcherbackend.cpp+10
Launcher/LauncherPanel.qml+37−17
@@ -46,8 +46,6 @@ Item {
4646 id: mainColumn
4747 anchors {
4848 fill: parent
49−// topMargin: units.gu(0.5)
50−// bottomMargin: units.gu(1)
5149 leftMargin: units.gu(0.5)
5250 rightMargin: units.gu(0.5)
5351 }
@@ -89,9 +87,11 @@ Item {
8987 ListView {
9088 id: launcherListView
9189 objectName: "launcherListView"
92− anchors.fill: parent
93− anchors.topMargin: -itemHeight
94− anchors.bottomMargin: -itemHeight
90+ anchors {
91+ fill: parent
92+ topMargin: -itemHeight + units.gu(0.5)
93+ bottomMargin: -itemHeight + units.gu(1)
94+ }
9595 topMargin: itemHeight
9696 bottomMargin: itemHeight
9797 height: parent.height - dashItem.height - parent.spacing*2
@@ -102,6 +102,7 @@ Item {
102102 preferredHighlightBegin: (height - itemHeight) / 2
103103 preferredHighlightEnd: (height + itemHeight) / 2
104104 layoutDirection: root.inverted ? Qt.RightToLeft : Qt.LeftToRight
105+ spacing: units.gu(0.5)
105106
106107 // The height of the area where icons start getting folded
107108 property int foldingAreaHeight: itemHeight * 0.75
@@ -114,6 +115,8 @@ Item {
114115 NumberAnimation { properties: "x,y"; duration: 100 }
115116 }
116117
118+ onContentYChanged: print("contentY", contentY)
119+
117120 delegate: LauncherListDelegate {
118121 id: launcherDelegate
119122 objectName: "launcherDelegate" + index
@@ -128,7 +131,21 @@ Item {
128131 maxAngle: 60
129132 property bool dragging: false
130133
134+ ThinDivider {
135+ anchors.centerIn: parent
136+ width: parent.width + mainColumn.anchors.leftMargin + mainColumn.anchors.rightMargin
137+ visible: parent.dragging
138+ }
139+
131140 states: [
141+ State {
142+ name: "pre-dragging"
143+ when: dndArea.selectedItem === launcherDelegate && fakeDragItem.visible && !dragging
144+ PropertyChanges {
145+ target: launcherDelegate
146+ itemOpacity: 0
147+ }
148+ },
132149 State {
133150 name: "dragging"
134151 when: dragging
@@ -137,6 +154,7 @@ Item {
137154 angle: root.inverted ? -80 : 80
138155 offset: effectiveHeight / 2
139156 height: effectiveHeight
157+ itemOpacity: 0
140158 }
141159 },
142160 State {
@@ -154,8 +172,12 @@ Item {
154172 Transition {
155173 from: "*"
156174 to: "*"
157−// NumberAnimation { properties: "angle,offset"; duration: 200 }
158− NumberAnimation { properties: "height"; duration: 150 }
175+ NumberAnimation { properties: "height,itemOpacity"; duration: 150 }
176+ },
177+ Transition {
178+ from: "dragging"
179+ to: "*"
180+ NumberAnimation { properties: "itemOpacity"; duration: 150 }
159181 }
160182 ]
161183 }
@@ -215,7 +237,6 @@ Item {
215237 onReleased: {
216238 print("released");
217239 selectedItem.highlighted = false
218− selectedItem.opacity = 1
219240 selectedItem.dragging = false;
220241 selectedItem = undefined;
221242
@@ -227,10 +248,10 @@ Item {
227248
228249 // FIXME: remove the if condition once the ListView position bug is fixed.
229250 // Right now setting currentIndex to 0 causes more issues than it helps.
230− if (droppedIndex > 2) {
231− launcherListView.currentIndex = -1;
232− launcherListView.currentIndex = droppedIndex;
233− }
251+// if (droppedIndex > 2) {
252+// launcherListView.currentIndex = -1;
253+// launcherListView.currentIndex = droppedIndex;
254+// }
234255 launcherListView.interactive = true;
235256 }
236257
@@ -253,8 +274,6 @@ Item {
253274 fakeDragItem.y = mouseY - yOffset
254275 drag.target = fakeDragItem
255276
256− selectedItem.opacity = 0
257−
258277 startX = mouseX
259278 startY = mouseY
260279 }
@@ -324,14 +343,14 @@ Item {
324343 property bool downwards: true
325344 onTriggered: {
326345 if (downwards) {
327− var minY = launcherListView.contentHeight - launcherListView.height + mainColumn.spacing*2
346+ var minY = -launcherListView.topMargin
328347 if (launcherListView.contentY > minY) {
329348 launcherListView.contentY = Math.max(launcherListView.contentY - units.dp(2), minY)
330349 }
331350 } else {
332− var maxY = -mainColumn.spacing*2
351+ var maxY = launcherListView.contentHeight - launcherListView.height + launcherListView.topMargin + dndArea.selectedItem.effectiveHeight*2
333352 if (launcherListView.contentY < maxY) {
334− print("moving upwards", launcherListView.contentY, maxY)
353+ print("moving upwards", launcherListView.contentHeight, launcherListView.height, launcherListView.topMargin, dndArea.selectedItem.height, dndArea.selectedItem.effectiveHeight)
335354 launcherListView.contentY = Math.min(launcherListView.contentY + units.dp(2), maxY)
336355 }
337356 }
@@ -374,6 +393,7 @@ Item {
374393 height: itemHeight
375394 width: itemWidth
376395 rotation: root.rotation
396+ highlighted: true
377397 }
378398 }
379399
plugins/Unity/Launcher/backend/launcherbackend.cpp+10
@@ -28,6 +28,16 @@ LauncherBackend::LauncherBackend(QObject *parent):
2828 // TODO: load default pinned ones from default config, instead of hardcoding here...
2929
3030 m_storedApps <<
31+ QLatin1String("phone-app.desktop") <<
32+ QLatin1String("camera-app.desktop") <<
33+ QLatin1String("gallery-app.desktop") <<
34+ QLatin1String("facebook-webapp.desktop") <<
35+ QLatin1String("webbrowser-app.desktop") <<
36+ QLatin1String("twitter-webapp.desktop") <<
37+ QLatin1String("gmail-webapp.desktop") <<
38+ QLatin1String("ubuntu-weather-app.desktop") <<
39+ QLatin1String("notes-app.desktop") <<
40+ QLatin1String("calendar-app.desktop") <<
3141 QLatin1String("phone-app.desktop") <<
3242 QLatin1String("camera-app.desktop") <<
3343 QLatin1String("gallery-app.desktop") <<