@@ -27,7 +27,7 @@ Item {
2727 property var model
2828 property bool inverted: false
2929 property bool dragging: false
30− property bool moving: launcherFlickable.moving
30+ property bool moving: launcherListView.moving
3131 property int dragPosition: 0
3232 property int highlightIndex: -1
3333
@@ -35,23 +35,23 @@ Item {
3535 signal dashItemSelected(int index)
3636
3737 onDragPositionChanged: {
38− var effectiveDragPosition = root.inverted ? launcherFlickable.height - dragPosition : dragPosition - mainColumn.anchors.margins
38+ var effectiveDragPosition = root.inverted ? launcherListView.height - dragPosition : dragPosition - mainColumn.anchors.margins
3939
40− var hiddenContentHeight = launcherFlickable.contentHeight - launcherFlickable.height
40+ var hiddenContentHeight = launcherListView.contentHeight - launcherListView.height
4141 // Shortening scrollable height because the first/last item needs to be fully expanded before reaching the top/bottom
42− var scrollableHeight = launcherFlickable.height - (launcherFlickable.itemSize + launcherColumn.spacing) *2
42+ var scrollableHeight = launcherListView.height - (launcherListView.itemSize + launcherColumn.spacing) *2
4343 // As we shortened the scrollableHeight, lets move everything down by the itemSize
44− var shortenedEffectiveDragPosition = effectiveDragPosition - launcherFlickable.itemSize - launcherColumn.spacing
44+ var shortenedEffectiveDragPosition = effectiveDragPosition - launcherListView.itemSize - launcherColumn.spacing
4545 var newContentY = shortenedEffectiveDragPosition * hiddenContentHeight / scrollableHeight
4646
4747 // limit top/bottom to prevent overshooting
48− launcherFlickable.contentY = Math.min(hiddenContentHeight, Math.max(0, newContentY));
48+ launcherListView.contentY = Math.min(hiddenContentHeight, Math.max(0, newContentY));
4949
5050 // Now calculate the current index:
5151 // > the current mouse position + the hidden/scolled content on top is the mouse position in the averall view
5252 // > adjust that removing all the margins
5353 // > divide by itemSize to get index
54− highlightIndex = (effectiveDragPosition + launcherFlickable.contentY - mainColumn.anchors.margins*3 - launcherColumn.spacing/2) / (launcherFlickable.itemSize + launcherColumn.spacing)
54+ highlightIndex = (effectiveDragPosition + launcherListView.contentY - mainColumn.anchors.margins*3 - launcherColumn.spacing/2) / (launcherListView.itemSize + launcherColumn.spacing)
5555 }
5656
5757 BorderImage {
@@ -76,6 +76,7 @@ Item {
7676 width: parent.width
7777 height: units.gu(6.5)
7878 onClicked: root.dashItemSelected(0)
79+ z: 1
7980 Image {
8081 objectName: "dashItem"
8182 width: units.gu(5.5)
@@ -92,46 +93,78 @@ Item {
9293 }
9394 }
9495
95− Flickable {
96− id: launcherFlickable
96+ Item {
9797 anchors.left: parent.left
9898 anchors.right: parent.right
9999 height: parent.height - dashItem.height - parent.spacing*2
100− contentHeight: launcherColumn.height
101−
102− property int itemSize: width
103−
104− Column {
105− id: launcherColumn
106− width: parent.width
107− //spacing: units.gu(1)
108− anchors.horizontalCenter: parent.horizontalCenter
109−
110− Repeater {
111− id: iconRepeater
112− model: root.model
113−
114− LauncherDelegate {
115− id: launcherDelegate
116− objectName: "launcherDelegate" + index
117− width: launcherFlickable.itemSize
118− height: launcherFlickable.itemSize
119− iconName: model.icon
120− inverted: root.inverted
121− highlighted: root.dragging && index === root.highlightIndex
122− z: -Math.abs(offset)
123− state: "docked"
124−
125− maxAngle: 60
126−
127− itemsBeforeThis: index
128− itemsAfterThis: iconRepeater.count - (index+1)
129−
130− onClicked: {
131− root.applicationSelected(launcherModel.get(index).desktopFile);
132− }
100+ ListView {
101+ id: launcherListView
102+ anchors.fill: parent
103+ anchors.topMargin: -itemSize
104+ anchors.bottomMargin: -itemSize
105+ topMargin: itemSize
106+ bottomMargin: itemSize
107+ height: parent.height - dashItem.height - parent.spacing*2
108+ model: root.model
109+ cacheBuffer: itemSize * 3
110+ snapMode: ListView.SnapToItem
111+ highlightRangeMode: ListView.ApplyRange
112+ preferredHighlightBegin: (height - itemSize) / 2
113+ preferredHighlightEnd: (height + itemSize) / 2
114+ currentIndex: 0
115+
116+ property int itemSize: width
117+
118+ // The height of the area where icons start getting folded
119+ property int foldingAreaHeight: itemSize * 0.75
120+
121+
122+ delegate: LauncherDelegate {
123+ id: launcherDelegate
124+ objectName: "launcherDelegate" + index
125+ width: launcherListView.itemSize
126+ height: launcherListView.itemSize
127+ iconName: model.icon
128+ inverted: root.inverted
129+ highlighted: root.dragging && index === root.highlightIndex
130+ z: -Math.abs(offset)
131+ state: "docked"
132+
133+ maxAngle: 60
134+
135+ itemsBeforeThis: index
136+ itemsAfterThis: launcherListView.count - (index+1)
137+
138+ onClicked: {
139+ root.applicationSelected(launcherModel.get(index).desktopFile);
133140 }
134141 }
142+
143+ MouseArea {
144+ id: topFoldingArea
145+ anchors {
146+ left: parent.left
147+ right: parent.right
148+ top: parent.top
149+ topMargin: launcherListView.topMargin
150+ }
151+ height: launcherListView.itemSize
152+ enabled: launcherListView.contentY > -launcherListView.topMargin
153+ onClicked: launcherListView.flick(0, units.gu(40))
154+ }
155+
156+ MouseArea {
157+ id: bottomFoldingArea
158+ anchors {
159+ left: parent.left
160+ right: parent.right
161+ bottom: parent.bottom
162+ bottomMargin: launcherListView.bottomMargin
163+ }
164+ height: launcherListView.itemSize
165+ enabled: launcherListView.contentHeight - launcherListView.height - launcherListView.contentY > -launcherListView.bottomMargin
166+ onClicked: launcherListView.flick(0, -units.gu(40))
167+ }
135168 }
136169 }
137170 }