diff --git a/src/graphitem.cpp b/src/graphitem.cpp index e8ed7b90..224987c7 100644 --- a/src/graphitem.cpp +++ b/src/graphitem.cpp @@ -120,9 +120,9 @@ void GraphItem::emitSliderPositionChanged(qreal pos) if (pos >= _graph.first().t() && pos <= _graph.last().t()) emit sliderPositionChanged(distanceAtTime(pos)); else - emit sliderPositionChanged(_graph.last().s() + 1); + emit sliderPositionChanged(NAN); } else - emit sliderPositionChanged(_graph.last().s() + 1); + emit sliderPositionChanged(NAN); } else emit sliderPositionChanged(pos); } diff --git a/src/graphview.cpp b/src/graphview.cpp index 9dd61426..1637fd74 100644 --- a/src/graphview.cpp +++ b/src/graphview.cpp @@ -400,6 +400,8 @@ void GraphView::emitSliderPositionChanged(const QPointF &pos) return; _sliderPos = (pos.x() / _slider->area().width()) * bounds().width(); + _sliderPos = qMax(_sliderPos, bounds().left()); + _sliderPos = qMin(_sliderPos, bounds().right()); updateSliderPosition(); emit sliderPositionChanged(_sliderPos); diff --git a/src/pathitem.cpp b/src/pathitem.cpp index 4e3e9bda..1520e236 100644 --- a/src/pathitem.cpp +++ b/src/pathitem.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -108,12 +109,11 @@ QPointF PathItem::position(qreal x) const void PathItem::moveMarker(qreal distance) { - if (distance > _distance.last()) - _marker->setVisible(false); - else { + if (distance >= _distance.first() && distance <= _distance.last()) { _marker->setVisible(true); _marker->setPos(position(distance)); - } + } else + _marker->setVisible(false); } void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)