Bug 126359

Summary: Zoom tool should be cancellable before releasing mouse button
Product: [Applications] kpdf Reporter: Jesús Jiménez <jesjimenez>
Component: generalAssignee: Albert Astals Cid <aacid>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jesús Jiménez 2006-04-27 17:32:06 UTC
Version:           0.4.3 (using KDE 3.4.3, Kubuntu Package 4:3.4.3-0ubuntu2 )
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.12-10-k7

Just a little usability improvement: when the zoom tool is selected, and the user starts to drag, it should be possible to cancel the zoom by hitting the esc key (like most programs allow in drag operations). 

Right now, it's impossible to stop the action once the drag has started, and I often find myself unconsciously zooming in when I really wanted to pan. If I could hit ESC to cancel the action, I could realize that the wrong tool is selected, and cancel it before releasing the mouse button.

Thanks for your attention and congratulations for such a nice piece of software, it kicks major ass!
Comment 1 Pino Toscano 2006-10-29 13:00:50 UTC
SVN commit 600007 by pino:

Cancel selecting when Esc is pressed.

BUG: 126359


 M  +11 -2     pageview.cpp  


--- branches/KDE/3.5/kdegraphics/kpdf/ui/pageview.cpp #600006:600007
@@ -574,7 +574,7 @@
     e->accept();
 
     // if performing a selection or dyn zooming, disable keys handling
-    if ( !d->mouseSelectionRect.isNull() || d->mouseMidStartY != -1 )
+    if ( ( !d->mouseSelectionRect.isNull() && e->key() != Qt::Key_Escape ) || d->mouseMidStartY != -1 )
         return;
 
     // handle 'find as you type' (based on khtml/khtmlview.cpp)
@@ -711,6 +711,15 @@
         case Key_Right:
             horizontalScrollBar()->addLine();
             break;
+        case Qt::Key_Escape:
+            selectionClear();
+            d->mousePressPos = QPoint();
+            if ( d->aPrevAction )
+            {
+                d->aPrevAction->activate();
+                d->aPrevAction = 0;
+            }
+            break;
         case Key_Shift:
         case Key_Control:
             if ( d->autoScrollTimer )
@@ -810,7 +819,7 @@
         case MouseZoom:
         case MouseSelect:
             // set second corner of selection
-            if ( leftButton || d->aPrevAction )
+            if ( !d->mousePressPos.isNull() && ( leftButton || d->aPrevAction ) )
                 selectionEndPoint( e->x(), e->y() );
             break;