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)
|
||||
{
|
||||
if (point.x() > sceneRect().width()
|
||||
|| point.x() < 0
|
||||
|| point.y() < 0
|
||||
|| point.y() > sceneRect().height())
|
||||
double xpos = timeLine->valueAt(point);
|
||||
double ypos = depthLine->valueAt(point);
|
||||
|
||||
if (xpos > timeLine->maximum()
|
||||
|| xpos < timeLine->minimum()
|
||||
|| ypos > depthLine->maximum()
|
||||
|| ypos < depthLine->minimum())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -325,3 +328,14 @@ DivePlanner* DivePlanner::instance()
|
|||
static DivePlanner *self = new DivePlanner();
|
||||
return self;
|
||||
}
|
||||
|
||||
double Ruler::maximum() const
|
||||
{
|
||||
return max;
|
||||
}
|
||||
|
||||
double Ruler::minimum() const
|
||||
{
|
||||
return min;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ public:
|
|||
void setTickInterval(double interval);
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
void updateTicks();
|
||||
double minimum() const;
|
||||
double maximum() const;
|
||||
qreal valueAt(const QPointF& p);
|
||||
qreal posAtValue(qreal value);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue