@@ -75,6 +75,7 @@ Item {
75 The scaling of the items is controlled by the variable continuousIndex, described below. */
75 The scaling of the items is controlled by the variable continuousIndex, described below. */
76 ListView {
76 ListView {
77 id: listView
77 id: listView
78+ objectName: "listView"
79 property int highlightIndex: -1
80 property int highlightIndex: -1
80 property real minimumTileWidth: 0
81 property real minimumTileWidth: 0
@@ -148,15 +149,19 @@ Item {
148 maximumFlickVelocity: Math.max(2500 * Math.pow(realWidth / referenceWidth, 1.5), 2500) // 2500 is platform default
149 maximumFlickVelocity: Math.max(2500 * Math.pow(realWidth / referenceWidth, 1.5), 2500) // 2500 is platform default
149 orientation: ListView.Horizontal
150 orientation: ListView.Horizontal
151− function itemClicked(index, delegateItem) {
152+ function getXFromContinuousIndex(index) {
152− listView.currentIndex = index
153− var x = CarouselJS.getXFromContinuousIndex(index,
153+ return CarouselJS.getXFromContinuousIndex(index,
154 realWidth,
154 realWidth,
155− realContentWidth,
155+ footerItem.x,
156 tileWidth,
156 tileWidth,
157 gapToMiddlePhase,
157 gapToMiddlePhase,
158 gapToEndPhase,
158 gapToEndPhase,
159 carousel.drawBuffer)
159 carousel.drawBuffer)
162+ function itemClicked(index, delegateItem) {
163+ listView.currentIndex = index
164+ var x = getXFromContinuousIndex(index);
161 if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
166 if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
162 /* We're clicking the selected item and
167 /* We're clicking the selected item and
@@ -174,13 +179,7 @@ Item {
176 function itemPressAndHold(index, delegateItem) {
181 function itemPressAndHold(index, delegateItem) {
177− var x = CarouselJS.getXFromContinuousIndex(index,
182+ var x = getXFromContinuousIndex(index);
183− carousel.drawBuffer);
185 if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
184 if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
186 /* We're pressAndHold the selected item and
185 /* We're pressAndHold the selected item and
@@ -209,22 +208,17 @@ Item {
209 newContentX = disabledNewContentX
208 newContentX = disabledNewContentX
211 onMovementEnded: {
210 onMovementEnded: {
212− if (realContentX > 0 && realContentX < realContentWidth - realWidth)
211+ if (realContentX > 0)
213 stepAnimation.start()
212 stepAnimation.start()
216 SmoothedAnimation {
215 SmoothedAnimation {
217 id: stepAnimation
216 id: stepAnimation
217+ objectName: "stepAnimation"
219 target: listView
219 target: listView
220 property: "contentX"
220 property: "contentX"
221− to: CarouselJS.getXFromContinuousIndex(listView.selectedIndex,
221+ to: listView.getXFromContinuousIndex(listView.selectedIndex)
223− listView.realContentWidth,
225− listView.gapToMiddlePhase,
226− listView.gapToEndPhase,
227− carousel.drawBuffer)
228 duration: 450
222 duration: 450
229 velocity: 200
223 velocity: 200
230 easing.type: Easing.InOutQuad
224 easing.type: Easing.InOutQuad