[PATCH] planner: disable mouse interaction when zoomed in

Lubomir I. Ivanov neolit123 at gmail.com
Tue Mar 10 18:23:45 PDT 2015


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

When zoomed in, things like moving planner points is not possible,
but if the user attempts that, replan() -> plotDive() is called
and the zoomLevel should be reset to the default value (we don't
really want that), but instead it's lost for some reason
(as the user reports: "Somes times, it changes to 100% which is ok").

If moving points becomes possible eventually while zoomed in,
we need to figure a way to replot without resetting the zoom level
in plotDive().

fixes #851

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---

the patch also disables the generic profile press and release events,
when zoomed-in, so let me know if this breaks something which is by
design.

ideally we should support interaction while zoomed in, but
it seems tricky due to the auto-pan and i suspect that's what
causes the loss of default zoomLevel.

my related criticism for QGraphicsView is that uses accumulative
scale(), which is just bad(tm) instead of using the intuitive
"scale(0.1, 0.1) means 1 / 10 of my default scale which is (1.0, 1.0)
at all times".

attempting to solve that with an identity matrix doesn't work for me.
there could be another solution which i'm not aware of.
---
 qt-ui/profile/profilewidget2.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index cfcd25d..d385e0c 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -733,6 +733,8 @@ void ProfileWidget2::resizeEvent(QResizeEvent *event)
 
 void ProfileWidget2::mousePressEvent(QMouseEvent *event)
 {
+	if (zoomLevel)
+		return;
 	QGraphicsView::mousePressEvent(event);
 	if (currentState == PLAN)
 		shouldCalculateMaxTime = false;
@@ -740,18 +742,24 @@ void ProfileWidget2::mousePressEvent(QMouseEvent *event)
 
 void ProfileWidget2::divePlannerHandlerClicked()
 {
+	if (zoomLevel)
+		return;
 	shouldCalculateMaxDepth = false;
 	replot();
 }
 
 void ProfileWidget2::divePlannerHandlerReleased()
 {
+	if (zoomLevel)
+		return;
 	shouldCalculateMaxDepth = true;
 	replot();
 }
 
 void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event)
 {
+	if (zoomLevel)
+		return;
 	QGraphicsView::mouseReleaseEvent(event);
 	if (currentState == PLAN) {
 		shouldCalculateMaxTime = true;
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list