@@ -39,6 +39,8 @@ Item {
3939
4040 property bool dragging:false
4141
42+ property ListView listView: ListView.view
43+
4244 signal clicked()
4345 signal longtap()
4446 signal released()
@@ -153,16 +155,17 @@ Item {
153155 QtObject {
154156 id: priv
155157
156− property real totalUnfoldedHeight: launcherListView.itemSize + launcherListView.spacing
157− property real totalEffectiveHeight: effectiveHeight + launcherListView.spacing
158− property real distanceFromTopEdge: -(launcherListView.contentY + launcherListView.topMargin - itemsBeforeThis*totalUnfoldedHeight)
159− property real distanceFromBottomEdge: launcherListView.height - launcherListView.bottomMargin - (y+height) + launcherListView.contentY
158+ property real totalUnfoldedHeight: listView.itemSize + listView.spacing
159+ property real totalEffectiveHeight: effectiveHeight + listView.spacing
160+ property real distanceFromTopEdge: -(listView.contentY + listView.topMargin - itemsBeforeThis*totalUnfoldedHeight)
161+ property real distanceFromBottomEdge: listView.height - listView.bottomMargin - (y+height) + listView.contentY
160162
161163 property real distanceFromEdge: Math.abs(distanceFromBottomEdge) < Math.abs(distanceFromTopEdge) ? distanceFromBottomEdge : distanceFromTopEdge
162164 property real orientationFlag: Math.abs(distanceFromBottomEdge) < Math.abs(distanceFromTopEdge) ? -1 : 1
163165
164− property real overlapWithFoldingArea: launcherListView.foldingAreaHeight - distanceFromEdge
166+ property real overlapWithFoldingArea: listView.foldingAreaHeight - distanceFromEdge
165167
168+ Component.onCompleted: print("created delegate. listview is", listView)
166169 }
167170
168171 states: [
@@ -174,7 +177,7 @@ Item {
174177 // This is the offset that keeps the items inside the panel
175178 offset: {
176179 // First/last items are special
177− if (index == 0 || index == launcherListView.count-1) {
180+ if (index == 0 || index == listView.count-1) {
178181 // Just keep them bound to the edges in case they're outside of the visible area
179182 if (priv.distanceFromEdge < 0) {
180183 return (-priv.distanceFromEdge - (height - effectiveHeight)) * priv.orientationFlag;
@@ -199,10 +202,10 @@ Item {
199202 angle: {
200203 //return 0;
201204 // First item is special
202− if (index == 0 || index == launcherListView.count-1) {
205+ if (index == 0 || index == listView.count-1) {
203206 if (priv.distanceFromEdge < 0) {
204207 // distanceFromTopEdge : angle = totalUnfoldedHeight/2 : maxAngle
205− return Math.max(-maxAngle, priv.distanceFromEdge * maxAngle / (launcherListView.foldingAreaHeight)) * priv.orientationFlag
208+ return Math.max(-maxAngle, priv.distanceFromEdge * maxAngle / (listView.foldingAreaHeight)) * priv.orientationFlag
206209 }
207210 return 0; // Don't fold first item as long as inside the view
208211 }
@@ -210,13 +213,13 @@ Item {
210213 // Are we in the already completely outside the flickable? Fold for the last 5 degrees
211214 if (priv.distanceFromEdge < 0) {
212215 // -distanceFromTopEdge : angle = totalUnfoldedHeight : 5
213− return Math.max(-maxAngle, (priv.distanceFromEdge * 5 / launcherListView.foldingAreaHeight) - (maxAngle-5)) * priv.orientationFlag
216+ return Math.max(-maxAngle, (priv.distanceFromEdge * 5 / listView.foldingAreaHeight) - (maxAngle-5)) * priv.orientationFlag
214217 }
215218
216219 // We are overlapping with the folding area, fold the icon to maxAngle - 5 degrees
217220 if (priv.overlapWithFoldingArea > 0) {
218221 // overlap: totalHeight = angle : (maxAngle - 5)
219− return -priv.overlapWithFoldingArea * (maxAngle -5) / launcherListView.foldingAreaHeight * priv.orientationFlag;
222+ return -priv.overlapWithFoldingArea * (maxAngle -5) / listView.foldingAreaHeight * priv.orientationFlag;
220223
221224 }
222225
@@ -225,10 +228,10 @@ Item {
225228
226229 opacity: {
227230 // First item is special
228− if (index == 0 || index == launcherListView.count-1) {
231+ if (index == 0 || index == listView.count-1) {
229232 if (priv.distanceFromEdge < 0) {
230233 // Fade from 1 to 0 in the distance of 3 * foldingAreaHeight (which is when the next item reaches the edge)
231− return 1.0 - (-priv.distanceFromEdge / (launcherListView.foldingAreaHeight * 3))
234+ return 1.0 - (-priv.distanceFromEdge / (listView.foldingAreaHeight * 3))
232235 }
233236 return 1; // Don't make first/last item transparent as long as inside the view
234237 }
@@ -242,15 +245,15 @@ Item {
242245 // We are overlapping with the folding area, fade out to 0.75
243246 if (priv.overlapWithFoldingArea > 0) {
244247 // overlap : totalHeight = 1-opacity : 0.25
245− return 1 - (priv.overlapWithFoldingArea * 0.25 / launcherListView.foldingAreaHeight)
248+ return 1 - (priv.overlapWithFoldingArea * 0.25 / listView.foldingAreaHeight)
246249 }
247250 return 1;
248251 }
249252
250253 brightness: {
251− if (index == 0 || index == launcherListView.count-1) {
254+ if (index == 0 || index == listView.count-1) {
252255 if (priv.distanceFromEdge < 0) {
253− return -(-priv.distanceFromEdge / (launcherListView.foldingAreaHeight * 3))
256+ return -(-priv.distanceFromEdge / (listView.foldingAreaHeight * 3))
254257 }
255258 return 0;
256259 }
@@ -259,7 +262,7 @@ Item {
259262 }
260263
261264 if (priv.overlapWithFoldingArea > 0) {
262− return - (priv.overlapWithFoldingArea * 0.3 / launcherListView.foldingAreaHeight)
265+ return - (priv.overlapWithFoldingArea * 0.3 / listView.foldingAreaHeight)
263266 }
264267 return 0;
265268 }