diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/diveplanner.cpp | 22 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 2 |
2 files changed, 20 insertions, 4 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 21d134d04..bc774cc83 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -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; +} + diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index 4a28f2ec1..ce4dd6d4f 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -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); |