@@ -16,7 +16,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
19−ListView {
19+Flickable {
22 signal clicked(int index, var result)
22 signal clicked(int index, var result)
@@ -26,30 +26,46 @@ ListView {
26 property real scopeHeight: 0
26 property real scopeHeight: 0
27 property real scopeWidth: 0
27 property real scopeWidth: 0
28 property real appliedScale: 1
28 property real appliedScale: 1
29+ property int currentIndex: -1
30+ property var currentItem: repeater.itemAt(currentIndex);
30− orientation: ListView.Horizontal
32+ property alias model: repeater.model
31− highlightMoveDuration: 0
34+ contentHeight: height
33− spacing: units.gu(2) / appliedScale
35+ contentWidth: repeater.count * root.scopeWidth + units.gu(2) / appliedScale * (repeater.count - 1)
35− delegate: Loader {
37+ contentX: {
36− id: loader
38+ var indexX = currentIndex * scopeWidth + units.gu(2) / appliedScale * currentIndex;
39+ var newContentX = indexX - (width - scopeWidth) / 2;
40+ newContentX = Math.min(Math.max(newContentX, 0), contentWidth - width);
50+ x: index * root.scopeWidth + units.gu(2) / appliedScale * index
38− sourceComponent: cardTool.cardComponent
53+ sourceComponent: cardTool.cardComponent
39− onLoaded: {
54+ onLoaded: {
40− item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; });
55+ item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; });
41− item.fontScale = Qt.binding(function() { return 1 / appliedScale; });
56+ item.fontScale = Qt.binding(function() { return 1 / appliedScale; });
42− item.height = Qt.binding(function() { return root.scopeHeight; });
57+ item.height = Qt.binding(function() { return root.scopeHeight; });
43− item.width = Qt.binding(function() { return root.scopeWidth; });
58+ item.width = Qt.binding(function() { return root.scopeWidth; });
44− item.cardData = Qt.binding(function() { return model; });
59+ item.cardData = Qt.binding(function() { return model; });
45− item.template = Qt.binding(function() { return cardTool.template; });
60+ item.template = Qt.binding(function() { return cardTool.template; });
46− item.components = Qt.binding(function() { return cardTool.components; });
61+ item.components = Qt.binding(function() { return cardTool.components; });
47− item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
62+ item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
50− Connections {
65+ Connections {
51− target: loader.item
66+ target: loader.item
52− onClicked: root.clicked(index, result)
67+ onClicked: root.clicked(index, result)