@@ -75,6 +75,7 @@ Item {
7575 The scaling of the items is controlled by the variable continuousIndex, described below. */
7676 ListView {
7777 id: listView
78+ objectName: "listView"
7879
7980 property int highlightIndex: -1
8081 property real minimumTileWidth: 0
@@ -148,15 +149,19 @@ Item {
148149 maximumFlickVelocity: Math.max(2500 * Math.pow(realWidth / referenceWidth, 1.5), 2500) // 2500 is platform default
149150 orientation: ListView.Horizontal
150151
151− function itemClicked(index, delegateItem) {
152− listView.currentIndex = index
153− var x = CarouselJS.getXFromContinuousIndex(index,
152+ function getXFromContinuousIndex(index) {
153+ return CarouselJS.getXFromContinuousIndex(index,
154154 realWidth,
155− realContentWidth,
155+ footerItem.x,
156156 tileWidth,
157157 gapToMiddlePhase,
158158 gapToEndPhase,
159159 carousel.drawBuffer)
160+ }
161+
162+ function itemClicked(index, delegateItem) {
163+ listView.currentIndex = index
164+ var x = getXFromContinuousIndex(index);
160165
161166 if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
162167 /* We're clicking the selected item and
@@ -174,13 +179,7 @@ Item {
174179 }
175180
176181 function itemPressAndHold(index, delegateItem) {
177− var x = CarouselJS.getXFromContinuousIndex(index,
178− realWidth,
179− realContentWidth,
180− tileWidth,
181− gapToMiddlePhase,
182− gapToEndPhase,
183− carousel.drawBuffer);
182+ var x = getXFromContinuousIndex(index);
184183
185184 if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
186185 /* We're pressAndHold the selected item and
@@ -209,22 +208,17 @@ Item {
209208 newContentX = disabledNewContentX
210209 }
211210 onMovementEnded: {
212− if (realContentX > 0 && realContentX < realContentWidth - realWidth)
211+ if (realContentX > 0)
213212 stepAnimation.start()
214213 }
215214
216215 SmoothedAnimation {
217216 id: stepAnimation
217+ objectName: "stepAnimation"
218218
219219 target: listView
220220 property: "contentX"
221− to: CarouselJS.getXFromContinuousIndex(listView.selectedIndex,
222− listView.realWidth,
223− listView.realContentWidth,
224− listView.tileWidth,
225− listView.gapToMiddlePhase,
226− listView.gapToEndPhase,
227− carousel.drawBuffer)
221+ to: listView.getXFromContinuousIndex(listView.selectedIndex)
228222 duration: 450
229223 velocity: 200
230224 easing.type: Easing.InOutQuad