on xenial help sign in
move listView property into priv object
commitfd6dcb0051fe1c1cf45ba6566aee65a98525ea38 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 25 Jun 2013, 17:32 (13 years ago) parentf60e86f
1 file changed+12−13
Launcher/LauncherDelegate.qml+12−13
Launcher/LauncherDelegate.qml+12−13
@@ -36,8 +36,6 @@ Item {
3636
3737 property bool dragging:false
3838
39− readonly property ListView listView: ListView.view
40−
4139 signal clicked()
4240 signal longtap()
4341 signal released()
@@ -155,6 +153,7 @@ Item {
155153 QtObject {
156154 id: priv
157155
156+ property ListView listView: root.ListView.view
158157 property real totalUnfoldedHeight: listView.itemSize + listView.spacing
159158 property real totalEffectiveHeight: effectiveHeight + listView.spacing
160159 property real effectiveContentY: listView.contentY - listView.originY
@@ -177,7 +176,7 @@ Item {
177176 // This is the offset that keeps the items inside the panel
178177 offset: {
179178 // First/last items are special
180− if (index == 0 || index == listView.count-1) {
179+ if (index == 0 || index == priv.listView.count-1) {
181180 // Just keep them bound to the edges in case they're outside of the visible area
182181 if (priv.distanceFromEdge < 0) {
183182 return (-priv.distanceFromEdge - (height - effectiveHeight)) * priv.orientationFlag;
@@ -200,10 +199,10 @@ Item {
200199 // The angle used for rotating
201200 angle: {
202201 // First/last items are special
203− if (index == 0 || index == listView.count-1) {
202+ if (index == 0 || index == priv.listView.count-1) {
204203 if (priv.distanceFromEdge < 0) {
205204 // proportion equation: distanceFromTopEdge : angle = totalUnfoldedHeight/2 : maxAngle
206− return Math.max(-maxAngle, priv.distanceFromEdge * maxAngle / (listView.foldingAreaHeight)) * priv.orientationFlag
205+ return Math.max(-maxAngle, priv.distanceFromEdge * maxAngle / (priv.listView.foldingAreaHeight)) * priv.orientationFlag
207206 }
208207 return 0; // Don't fold first/last item as long as inside the view
209208 }
@@ -211,23 +210,23 @@ Item {
211210 // Are we in the already completely outside the flickable? Fold for the last 5 degrees
212211 if (priv.distanceFromEdge < 0) {
213212 // proportion equation: -distanceFromTopEdge : angle = totalUnfoldedHeight : 5
214− return Math.max(-maxAngle, (priv.distanceFromEdge * 5 / listView.foldingAreaHeight) - (maxAngle-5)) * priv.orientationFlag
213+ return Math.max(-maxAngle, (priv.distanceFromEdge * 5 / priv.listView.foldingAreaHeight) - (maxAngle-5)) * priv.orientationFlag
215214 }
216215
217216 // We are overlapping with the folding area, fold the icon to maxAngle - 5 degrees
218217 if (priv.overlapWithFoldingArea > 0) {
219218 // proportion equation: overlap: totalHeight = angle : (maxAngle - 5)
220− return -priv.overlapWithFoldingArea * (maxAngle -5) / listView.foldingAreaHeight * priv.orientationFlag;
219+ return -priv.overlapWithFoldingArea * (maxAngle -5) / priv.listView.foldingAreaHeight * priv.orientationFlag;
221220 }
222221 return 0;
223222 }
224223
225224 itemOpacity: {
226225 // First/last items are special
227− if (index == 0 || index == listView.count-1) {
226+ if (index == 0 || index == priv.listView.count-1) {
228227 if (priv.distanceFromEdge < 0) {
229228 // Fade from 1 to 0 in the distance of 3 * foldingAreaHeight (which is when the next item reaches the edge)
230− return 1.0 - (-priv.distanceFromEdge / (listView.foldingAreaHeight * 3))
229+ return 1.0 - (-priv.distanceFromEdge / (priv.listView.foldingAreaHeight * 3))
231230 }
232231 return 1; // Don't make first/last item transparent as long as inside the view
233232 }
@@ -241,16 +240,16 @@ Item {
241240 // We are overlapping with the folding area, fade out to 0.75
242241 if (priv.overlapWithFoldingArea > 0) {
243242 // proportion equation: overlap : totalHeight = 1-opacity : 0.25
244− return 1 - (priv.overlapWithFoldingArea * 0.25 / listView.foldingAreaHeight)
243+ return 1 - (priv.overlapWithFoldingArea * 0.25 / priv.listView.foldingAreaHeight)
245244 }
246245 return 1;
247246 }
248247
249248 brightness: {
250249 // First/last items are special
251− if (index == 0 || index == listView.count-1) {
250+ if (index == 0 || index == priv.listView.count-1) {
252251 if (priv.distanceFromEdge < 0) {
253− return -(-priv.distanceFromEdge / (listView.foldingAreaHeight * 3))
252+ return -(-priv.distanceFromEdge / (priv.listView.foldingAreaHeight * 3))
254253 }
255254 return 0;
256255 }
@@ -261,7 +260,7 @@ Item {
261260
262261 // We are overlapping with the folding area, fade out to 0.7
263262 if (priv.overlapWithFoldingArea > 0) {
264− return - (priv.overlapWithFoldingArea * 0.3 / listView.foldingAreaHeight)
263+ return - (priv.overlapWithFoldingArea * 0.3 / priv.listView.foldingAreaHeight)
265264 }
266265 return 0;
267266 }