@@ -21,6 +21,7 @@ import "../Components"
23 property alias expanded: row.expanded
23 property alias expanded: row.expanded
24+ property alias interactive: flickable.interactive
24 property alias indicatorsModel: row.indicatorsModel
25 property alias indicatorsModel: row.indicatorsModel
25 property alias unitProgress: row.unitProgress
26 property alias unitProgress: row.unitProgress
26 property alias enableLateralChanges: row.enableLateralChanges
27 property alias enableLateralChanges: row.enableLateralChanges
@@ -43,10 +44,6 @@ Item {
43 row.setCurrentItemIndex(index);
44 row.setCurrentItemIndex(index);
46− function alignIndicators() {
47− alignmentTimer.start();
50 function addScrollOffset(scrollAmmout) {
47 function addScrollOffset(scrollAmmout) {
51 if (scrollAmmout < 0) { // left scroll
48 if (scrollAmmout < 0) { // left scroll
52 if (flickable.contentX < 0) return; // already off the left.
49 if (flickable.contentX < 0) return; // already off the left.
@@ -89,6 +86,23 @@ Item {
89 Behavior on alignmentAdjustment {
86 Behavior on alignmentAdjustment {
90 NumberAnimation { duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}
87 NumberAnimation { duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}
90+ function alignIndicators() {
91+ flickable.resetContentXComponents();
93+ if (expanded && !flickable.moving) {
94+ // gap between left and row?
95+ if (row.width > flickable.width && flickable.contentX < 0) {
96+ d.alignmentAdjustment += flickable.contentX;
97+ // current item overlap on left
98+ } else if (row.currentItem.x < flickable.contentX) {
99+ d.alignmentAdjustment -= (row.currentItem.x - flickable.contentX);
100+ // current item overlap on right
101+ } else if (row.currentItem.x + row.currentItem.width > flickable.contentX + flickable.width) {
102+ d.alignmentAdjustment -= ((row.currentItem.x + row.currentItem.width) - (flickable.contentX + flickable.width));
94 Rectangle {
108 Rectangle {
@@ -113,10 +127,16 @@ Item {
114 anchors.fill: parent
128 anchors.fill: parent
115 contentWidth: row.width
129 contentWidth: row.width
116− interactive: root.expanded
130+ interactive: false
117 // align right + offset from row selection + scrolling
131 // align right + offset from row selection + scrolling
118 contentX: row.width - flickable.width - d.combinedOffset
132 contentX: row.width - flickable.width - d.combinedOffset
134+ // contentX can change by user interaction as well as user offset changes
135+ // This function re-aligns the offsets so that the offsets match the contentX
136+ function resetContentXComponents() {
137+ d.scrollOffset += (flickable.contentX - (row.width - flickable.width - d.combinedOffset));
120 rebound: Transition {
140 rebound: Transition {
121 NumberAnimation {
141 NumberAnimation {
122 properties: "x"
142 properties: "x"
@@ -150,7 +170,7 @@ Item {
150 enabled: root.expanded
170 enabled: root.expanded
151 onClicked: {
171 onClicked: {
152 row.selectItemAt(mouse.x);
172 row.selectItemAt(mouse.x);
153− alignIndicators();
173+ d.alignIndicators();
@@ -162,11 +182,8 @@ Item {
162 id: alignmentTimer
182 id: alignmentTimer
163 interval: UbuntuAnimation.FastDuration // enough for row animation.
183 interval: UbuntuAnimation.FastDuration // enough for row animation.
164 repeat: false
184 repeat: false
165− onTriggered: {
186+ onTriggered: d.alignIndicators();
166− if (expanded && !flickable.moving && row.width > flickable.width && flickable.contentX < 0) { // off the left.
167− d.alignmentAdjustment += flickable.contentX;
172 states: [
189 states: [
@@ -178,18 +195,18 @@ Item {
178 rowOffset: 0
195 rowOffset: 0
179 scrollOffset: 0
196 scrollOffset: 0
180 alignmentAdjustment: 0
197 alignmentAdjustment: 0
181 restoreEntryValues: false
199 restoreEntryValues: false
185 name: "expanded"
203 name: "expanded"
186− when: expanded
204+ when: expanded && !interactive
188 PropertyChanges {
206 PropertyChanges {
189 target: d
207 target: d
190 combinedOffset: rowOffset + alignmentAdjustment - scrollOffset
208 combinedOffset: rowOffset + alignmentAdjustment - scrollOffset
193 PropertyChanges {
210 PropertyChanges {
194 target: d
211 target: d
195 rowOffset: {
212 rowOffset: {
@@ -202,6 +219,25 @@ Item {
202 restoreEntryValues: false
219 restoreEntryValues: false
224+ when: expanded && interactive
228+ // don't use row offset anymore.
229+ d.scrollOffset -= d.rowOffset;
231+ d.initialItem = undefined;
232+ alignmentTimer.start();
237+ combinedOffset: rowOffset + alignmentAdjustment - scrollOffset
238+ restoreEntryValues: false
207 transitions: [
243 transitions: [