From 1e4d360d0c12969477122ecf72e6a4e6686142f3 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 21 Jun 2013 16:07:44 -0300 Subject: 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 --- qt-ui/diveplanner.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'qt-ui/diveplanner.cpp') 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; +} + -- cgit v1.2.3-70-g09d2