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())
|
if (pos >= _graph.first().t() && pos <= _graph.last().t())
|
||||||
emit sliderPositionChanged(distanceAtTime(pos));
|
emit sliderPositionChanged(distanceAtTime(pos));
|
||||||
else
|
else
|
||||||
emit sliderPositionChanged(_graph.last().s() + 1);
|
emit sliderPositionChanged(NAN);
|
||||||
} else
|
} else
|
||||||
emit sliderPositionChanged(_graph.last().s() + 1);
|
emit sliderPositionChanged(NAN);
|
||||||
} else
|
} else
|
||||||
emit sliderPositionChanged(pos);
|
emit sliderPositionChanged(pos);
|
||||||
}
|
}
|
||||||
|
@ -400,6 +400,8 @@ void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_sliderPos = (pos.x() / _slider->area().width()) * bounds().width();
|
_sliderPos = (pos.x() / _slider->area().width()) * bounds().width();
|
||||||
|
_sliderPos = qMax(_sliderPos, bounds().left());
|
||||||
|
_sliderPos = qMin(_sliderPos, bounds().right());
|
||||||
updateSliderPosition();
|
updateSliderPosition();
|
||||||
|
|
||||||
emit sliderPositionChanged(_sliderPos);
|
emit sliderPositionChanged(_sliderPos);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <cmath>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@ -108,12 +109,11 @@ QPointF PathItem::position(qreal x) const
|
|||||||
|
|
||||||
void PathItem::moveMarker(qreal distance)
|
void PathItem::moveMarker(qreal distance)
|
||||||
{
|
{
|
||||||
if (distance > _distance.last())
|
if (distance >= _distance.first() && distance <= _distance.last()) {
|
||||||
_marker->setVisible(false);
|
|
||||||
else {
|
|
||||||
_marker->setVisible(true);
|
_marker->setVisible(true);
|
||||||
_marker->setPos(position(distance));
|
_marker->setPos(position(distance));
|
||||||
}
|
} else
|
||||||
|
_marker->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
Loading…
Reference in New Issue
Block a user