Bug 130481

Summary: Clicking and dragging outside the direct canvas should still initiate an action
Product: [Applications] krita Reporter: Thomas Zander <zander>
Component: GeneralAssignee: Halla Rempt <halla>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Thomas Zander 2006-07-08 23:14:33 UTC
Version:           1.5.9 (using KDE 3.5.3, compiled sources)
Compiler:          Target: x86_64-linux-gnu
OS:                Linux (x86_64) release 2.6.13.2

When you have selected a tool you can paint by clicking and dragging. This works for most tools inside the boundaries of the painting as well as outside. Where outside is the gray area between the painting and the rulers.
For example you can paint half a rectangle by starting a drag outside the canvas.

The bug is that this does not work for all tools. The freehand is one. The Crop is another (though the crop should still clip to the canvas).

Please go through all tools and make them consistent.
Comment 1 Bart Coppens 2006-08-21 22:09:30 UTC
SVN commit 575636 by coppens:

Due to popular request: allow freehand painting strokes to start outside the image area. This would be especially handy together with wishlist item 132759

CCBUG:130481
CCBUG:132759

 M  +4 -2      kis_tool_freehand.cc  


--- branches/koffice/1.6/koffice/krita/ui/kis_tool_freehand.cc #575635:575636
@@ -81,9 +81,11 @@
 
     if (e->button() == QMouseEvent::LeftButton) {
         
+        // People complain that they can't start brush strokes outside of the image boundaries.
+        // This makes sense, especially when combined with BUG:132759, so commenting out the
+        // next line makes sense.
+        //if (!m_currentImage->bounds().contains(e->pos().floorQPoint())) return;
         
-        if (!m_currentImage->bounds().contains(e->pos().floorQPoint())) return;
-        
         initPaint(e);
         paintAt(e->pos(), e->pressure(), e->xTilt(), e->yTilt());
 
Comment 2 Halla Rempt 2006-11-03 11:45:54 UTC
SVN commit 601444 by rempt:

Fix crop tool so clicking outside the image area works
CCBUG: 130481


 M  +24 -15    kis_tool_crop.cc  


--- branches/koffice/1.6/koffice/krita/plugins/tools/tool_crop/kis_tool_crop.cc #601443:601444
@@ -147,25 +147,34 @@
 
         if (img && img->activeDevice() && e->button() == LeftButton) {
 
-            if (img->bounds().contains(e->pos().floorQPoint())) {
+            QPoint pos = e->pos().floorQPoint();
+            QRect b = img->bounds();
 
-                m_selecting = true;
+            if (pos.x() < b.x()) 
+                pos.setX(b.x());
+            else if (pos.x() > b.x() + b.width()) 
+                pos.setX(b.x() + b.width());
 
-                if( !m_haveCropSelection ) //if the selection is not set
-                {
-                    QPoint p = e->pos().floorQPoint();
-                    m_rectCrop = QRect( p.x(), p.y(), 0, 0);
-                    paintOutlineWithHandles();
-                }
-                else
-                {
-                    KisCanvasController *controller = m_subject->canvasController();
-                    m_mouseOnHandleType = mouseOnHandle(controller ->windowToView(e->pos().floorQPoint()));
-                    m_dragStart = e->pos().floorQPoint();
-                }
+            if (pos.y() < b.y())
+                pos.setY(b.y());
+            else if (pos.y() > b.y() + b.height())
+                pos.setY(b.y() + b.height());
+            
+            m_selecting = true;
 
-                updateWidgetValues();
+            if( !m_haveCropSelection ) //if the selection is not set
+            {
+                m_rectCrop = QRect( pos.x(), pos.y(), 0, 0);
+                paintOutlineWithHandles();
             }
+            else
+            {
+                KisCanvasController *controller = m_subject->canvasController();
+                m_mouseOnHandleType = mouseOnHandle(controller ->windowToView(pos));
+                m_dragStart = pos;
+            }
+
+            updateWidgetValues();
         }
     }
 }
Comment 3 Halla Rempt 2006-11-03 11:49:46 UTC
Checked all tools, fixed the crop tool. Forward ported to trunk.