mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Fixed graph bounds issue
This commit is contained in:
parent
80bc9f1f01
commit
23f5a317d0
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <cmath>
|
||||
#include <QApplication>
|
||||
#include <QCursor>
|
||||
#include <QPainter>
|
||||
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user