mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Do not plot dive handlers outside of the Plane area.
This patch makes the behavior of inserting new hanflers correct. it can only be inserted now inside of the plane defined by the Depth ruler and Time ruler. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
397a94fcd1
commit
1e4d360d0c
2 changed files with 20 additions and 4 deletions
|
@ -206,10 +206,13 @@ void DivePlannerGraphics::moveActiveHandler(QPointF pos)
|
||||||
|
|
||||||
bool DivePlannerGraphics::isPointOutOfBoundaries(QPointF point)
|
bool DivePlannerGraphics::isPointOutOfBoundaries(QPointF point)
|
||||||
{
|
{
|
||||||
if (point.x() > sceneRect().width()
|
double xpos = timeLine->valueAt(point);
|
||||||
|| point.x() < 0
|
double ypos = depthLine->valueAt(point);
|
||||||
|| point.y() < 0
|
|
||||||
|| point.y() > sceneRect().height())
|
if (xpos > timeLine->maximum()
|
||||||
|
|| xpos < timeLine->minimum()
|
||||||
|
|| ypos > depthLine->maximum()
|
||||||
|
|| ypos < depthLine->minimum())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -325,3 +328,14 @@ DivePlanner* DivePlanner::instance()
|
||||||
static DivePlanner *self = new DivePlanner();
|
static DivePlanner *self = new DivePlanner();
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Ruler::maximum() const
|
||||||
|
{
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Ruler::minimum() const
|
||||||
|
{
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ public:
|
||||||
void setTickInterval(double interval);
|
void setTickInterval(double interval);
|
||||||
void setOrientation(Qt::Orientation orientation);
|
void setOrientation(Qt::Orientation orientation);
|
||||||
void updateTicks();
|
void updateTicks();
|
||||||
|
double minimum() const;
|
||||||
|
double maximum() const;
|
||||||
qreal valueAt(const QPointF& p);
|
qreal valueAt(const QPointF& p);
|
||||||
qreal posAtValue(qreal value);
|
qreal posAtValue(qreal value);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue