@@ -49,8 +49,8 @@ Item {
49 property alias highlightIndex: listView.highlightIndex
49 property alias highlightIndex: listView.highlightIndex
50 /// The column count is required for API compatibility with FilterGrids
50 /// The column count is required for API compatibility with FilterGrids
51 readonly property int columns: listView.count
51 readonly property int columns: listView.count
52− /// Indicates that this component automatically centers the highlighted item
52+ /// exposes the delegate of the currentItem
53− readonly property bool highlightCentered: true
53+ readonly property alias currentItem: listView.currentItem
55 /// Emitted when the user clicked on an item
55 /// Emitted when the user clicked on an item
56 /// @param index is the index of the clicked item
56 /// @param index is the index of the clicked item
@@ -147,13 +147,9 @@ Item {
147 flickDeceleration: Math.max(1500 * Math.pow(realWidth / referenceWidth, 1.5), 1500) // 1500 is platform default
147 flickDeceleration: Math.max(1500 * Math.pow(realWidth / referenceWidth, 1.5), 1500) // 1500 is platform default
148 maximumFlickVelocity: Math.max(2500 * Math.pow(realWidth / referenceWidth, 1.5), 2500) // 2500 is platform default
148 maximumFlickVelocity: Math.max(2500 * Math.pow(realWidth / referenceWidth, 1.5), 2500) // 2500 is platform default
149 orientation: ListView.Horizontal
149 orientation: ListView.Horizontal
150− currentIndex: highlightIndex
151− highlightFollowsCurrentItem: true
152− preferredHighlightBegin: (width - tileWidth) * 0.5
153− preferredHighlightEnd: (width - tileWidth) * 0.5
154− highlightRangeMode: highlightIndex != -1 ? ListView.StrictlyEnforceRange : ListView.NoHighlightRange
156 function itemClicked(index, delegateItem) {
151 function itemClicked(index, delegateItem) {
152+ listView.currentIndex = index
157 var x = CarouselJS.getXFromContinuousIndex(index,
153 var x = CarouselJS.getXFromContinuousIndex(index,
158 realWidth,
154 realWidth,
159 realContentWidth,
155 realContentWidth,
@@ -201,6 +197,12 @@ Item {
201 newContentXAnimation.start();
197 newContentXAnimation.start();
200+ onHighlightIndexChanged: {
201+ if (highlightIndex != -1) {
202+ itemClicked(highlightIndex)
204 onMovementStarted: {
206 onMovementStarted: {
205 stepAnimation.stop()
207 stepAnimation.stop()
206 newContentXAnimation.stop()
208 newContentXAnimation.stop()
@@ -284,6 +286,9 @@ Item {
284 itemTranslationScale,
286 itemTranslationScale,
285 listView.maximumItemTranslation)
287 listView.maximumItemTranslation)
289+ readonly property real xTransform: listView.viewTranslation + translationX * listView.scaleFactor
290+ readonly property real center: x - listView.contentX + xTransform - drawBuffer + (width/2)
287 width: listView.tileWidth
292 width: listView.tileWidth
288 height: listView.tileHeight
293 height: listView.tileHeight
289 scale: itemScale * explicitScaleFactor
294 scale: itemScale * explicitScaleFactor
@@ -292,7 +297,7 @@ Item {
292 opacity: highlightIndex == -1 ? 1 : (highlightIndex == index ? 0.6 : 0.2)
297 opacity: highlightIndex == -1 ? 1 : (highlightIndex == index ? 0.6 : 0.2)
294 transform: Translate {
299 transform: Translate {
295− x: listView.viewTranslation + translationX * listView.scaleFactor
300+ x: xTransform
298 Behavior on explicitScaleFactor {
303 Behavior on explicitScaleFactor {