on xenial help sign in
fixed highlight offset
commit40122beb30b7baf0baa611c493abca109140cbb2 authorNick Dedekind <nick.dedekind@canonical.com> dateThu 9 Oct 2014, 11:54 (12 years ago) parent80ae288
1 file changed+16−25
qml/Panel/IndicatorItemRow.qml+16−25
qml/Panel/IndicatorItemRow.qml+16−25
@@ -181,40 +181,31 @@ Item {
181181
182182 // micromovements of the highlight line when user moves the finger across the items while pulling
183183 // the handle downwards.
184− Connections {
185− target: root
186− onLateralPositionChanged: {
187− if (!currentItem || lateralPosition == -1) {
188− highlight.highlightCenterOffset = 0;
189− return;
190− }
191− if (!enableLateralChanges) return;
192184
193− var itemMapped = root.mapToItem(currentItem, lateralPosition, 0);
185+ property real highlightCenterOffset: {
186+ if (!currentItem || lateralPosition == -1 || !enableLateralChanges) return 0;
194187
195− var distanceFromCenter = itemMapped.x - currentItem.width / 2;
196− if (distanceFromCenter > 0) {
197− distanceFromCenter = Math.max(0, distanceFromCenter - currentItem.width / 8);
198− } else {
199− distanceFromCenter = Math.min(0, distanceFromCenter + currentItem.width / 8);
200− }
188+ var itemMapped = root.mapToItem(currentItem, lateralPosition, 0);
201189
202− if (currentItem && currentItem.ownIndex === 0 && distanceFromCenter < 0) {
203− highlight.highlightCenterOffset = 0;
204− } else if (currentItem && currentItem.ownIndex === repeater.count-1 & distanceFromCenter > 0) {
205− highlight.highlightCenterOffset = 0;
206− } else {
207− highlight.highlightCenterOffset = (distanceFromCenter / (currentItem.width / 4)) * units.gu(1);
208− }
190+ var distanceFromCenter = itemMapped.x - currentItem.width / 2;
191+ if (distanceFromCenter > 0) {
192+ distanceFromCenter = Math.max(0, distanceFromCenter - currentItem.width / 8);
193+ } else {
194+ distanceFromCenter = Math.min(0, distanceFromCenter + currentItem.width / 8);
209195 }
210− }
211196
212− property real highlightCenterOffset: 0
197+ if (currentItem && currentItem.ownIndex === 0 && distanceFromCenter < 0) {
198+ return 0;
199+ } else if (currentItem && currentItem.ownIndex === repeater.count-1 & distanceFromCenter > 0) {
200+ return 0;
201+ }
202+ return (distanceFromCenter / (currentItem.width / 4)) * units.gu(1);
203+ }
213204 Behavior on highlightCenterOffset {
214205 NumberAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
215206 }
216207
217− property real currentItemX: currentItem ? currentItem.x : 0 // having Behavior
208+ property real currentItemX: currentItem ? currentItem.x : 0
218209 Behavior on currentItemX {
219210 id: currentItemXBehavior
220211 enabled: !d.firstItemSwitch && expanded