@@ -35,15 +35,19 @@ Item {
36 property real lateralPosition: -1
36 property real lateralPosition: -1
37 onLateralPositionChanged: {
37 onLateralPositionChanged: {
38− if (lateralPosition == -1) return;
38+ if (currentItem && !enableLateralChanges) return;
39+ updateItemFromLateralPosition(lateralPosition);
40+ highlight.updateHighlightOffset();
43+ function updateItemFromLateralPosition(lateralPosition) {
44+ if (lateralPosition === -1) return;
40 if (!currentItem) {
46 if (!currentItem) {
41 selectItemAt(lateralPosition);
47 selectItemAt(lateralPosition);
45− if (!enableLateralChanges) return;
47 var maximumBufferOffset = selectionChangeBuffer * unitProgress;
51 var maximumBufferOffset = selectionChangeBuffer * unitProgress;
48 var proposedItem = indicatorAt(lateralPosition, 0);
52 var proposedItem = indicatorAt(lateralPosition, 0);
49 if (proposedItem) {
53 if (proposedItem) {
@@ -177,9 +181,11 @@ Item {
178 // micromovements of the highlight line when user moves the finger across the items while pulling
182 // micromovements of the highlight line when user moves the finger across the items while pulling
179 // the handle downwards.
183 // the handle downwards.
180− property real highlightCenterOffset: {
184+ function updateHighlightOffset() {
181− if (!currentItem || lateralPosition == -1) return 0;
185+ if (!currentItem || lateralPosition == -1) {
182− if (!enableLateralChanges) return 0;
186+ highlightCenterOffset = 0;
184 var itemMapped = root.mapToItem(currentItem, lateralPosition, 0);
190 var itemMapped = root.mapToItem(currentItem, lateralPosition, 0);
@@ -191,24 +197,25 @@ Item {
193 if (currentItem && currentItem.ownIndex === 0 && distanceFromCenter < 0) {
199 if (currentItem && currentItem.ownIndex === 0 && distanceFromCenter < 0) {
194− return 0;
200+ highlightCenterOffset = 0;
195 } else if (currentItem && currentItem.ownIndex === repeater.count-1 & distanceFromCenter > 0) {
201 } else if (currentItem && currentItem.ownIndex === repeater.count-1 & distanceFromCenter > 0) {
196− return 0;
202+ highlightCenterOffset = 0;
204+ var shiftPercentageOffset = (distanceFromCenter / (currentItem.width / 4));
205+ highlightCenterOffset = shiftPercentageOffset * units.gu(1);
199− var shiftPercentageOffset = (distanceFromCenter / (currentItem.width / 4));
200− return shiftPercentageOffset * units.gu(1);
209+ property real highlightCenterOffset: 0
202 Behavior on highlightCenterOffset {
210 Behavior on highlightCenterOffset {
203− id: highlightCetnerOffsetBehavior
204− SmoothedAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
211+ NumberAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
207 property real currentItemX: currentItem ? currentItem.x : 0 // having Behavior
214 property real currentItemX: currentItem ? currentItem.x : 0 // having Behavior
208 Behavior on currentItemX {
215 Behavior on currentItemX {
209 id: currentItemXBehavior
216 id: currentItemXBehavior
210 enabled: !d.firstItemSwitch && expanded
217 enabled: !d.firstItemSwitch && expanded
211− SmoothedAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
218+ NumberAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
213 x: currentItemX + highlightCenterOffset
220 x: currentItemX + highlightCenterOffset