on xenial help sign in
Fix 1195349 by counting drawbuffer on the newContentX logic of the carousel

When we changed carousel from repeater to listview, we added drawbuffer. this breaks the logic of newContentX, which was considered disabled and set to -1. The correct disabled value now has to take into account the drawbuffer.

commit6e1371b3536b91989672a9dcc469170d719b734f authorAndrea Cimitan <andrea.cimitan@canonical.com> dateThu 17 Oct 2013, 12:05 (13 years ago) parent39d6b5e7e3c79f
1 file changed+5−4
Components/Carousel.qml+5−4
Components/Carousel.qml+5−4
@@ -72,7 +72,7 @@ Item {
7272 id: listView
7373
7474 property real minimumTileWidth: 0
75− property real newContentX: -1
75+ property real newContentX: disabledNewContentX
7676 property real pathItemCount: referenceWidth / referenceTileWidth
7777 property real tileAspectRatio: 1
7878
@@ -100,6 +100,7 @@ Item {
100100 readonly property real kMiddleIndex: (realWidth / 2) / tileWidth - 0.5
101101 readonly property real kXBeginningEnd: 1 / tileWidth + kMiddleIndex / gapToMiddlePhase
102102 readonly property real maximumItemTranslation: (listView.tileWidth * 3) / listView.scaleFactor
103+ readonly property real disabledNewContentX: -carousel.drawBuffer - 1
103104 readonly property real realContentWidth: contentWidth - 2 * carousel.drawBuffer
104105 readonly property real realContentX: contentX + carousel.drawBuffer
105106 readonly property real realPathItemCount: Math.min(realWidth / tileWidth, pathItemCount)
@@ -192,7 +193,7 @@ Item {
192193 onMovementStarted: {
193194 stepAnimation.stop()
194195 newContentXAnimation.stop()
195− newContentX = -1
196+ newContentX = disabledNewContentX
196197 }
197198 onMovementEnded: {
198199 if (realContentX > 0 && realContentX < realContentWidth - realWidth)
@@ -228,7 +229,7 @@ Item {
228229 easing.type: Easing.InOutQuad
229230 }
230231 ScriptAction {
231− script: listView.newContentX = -1
232+ script: listView.newContentX = listView.disabledNewContentX
232233 }
233234 }
234235
@@ -253,7 +254,7 @@ Item {
253254 readonly property bool explicitScale: (!listView.moving ||
254255 listView.realContentX <= 0 ||
255256 listView.realContentX >= listView.realContentWidth - listView.realWidth) &&
256− listView.newContentX < 0 &&
257+ listView.newContentX === listView.disabledNewContentX &&
257258 index === listView.selectedIndex
258259 readonly property real cachedTiles: listView.realPathItemCount + carousel.drawBuffer / listView.tileWidth
259260 readonly property real distance: listView.continuousIndex - index