1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Fixed slider step size in time graphs

This commit is contained in:
Martin Tůma 2016-09-27 01:48:45 +02:00
parent 29fe054d57
commit eae55b14bb

View File

@ -119,12 +119,15 @@ qreal GraphItem::distanceAtTime(qreal time)
return _distancePath.elementAt(mid).x;
}
QLineF l;
if (_timePath.elementAt(mid).x < time)
return ((_distancePath.elementAt(mid+1).x
+ _distancePath.elementAt(mid).x) / 2.0);
l = QLineF(_timePath.elementAt(mid).x, _distancePath.elementAt(mid).x,
_timePath.elementAt(mid+1).x, _distancePath.elementAt(mid+1).x);
else
return ((_distancePath.elementAt(mid).x
+ _distancePath.elementAt(mid-1).x) / 2.0);
l = QLineF(_timePath.elementAt(mid-1).x, _distancePath.elementAt(mid-1).x,
_timePath.elementAt(mid).x, _distancePath.elementAt(mid).x);
return l.pointAt((time - l.p1().x()) / (l.p2().x() - l.p1().x())).y();
}
void GraphItem::emitSliderPositionChanged(qreal pos)