[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    [krita] libs/ui/tool: Make Move Selection action work only on the outline of the selection
From:       Boudewijn Rempt <null () kde ! org>
Date:       2018-10-10 20:05:41
Message-ID: E1gAKjl-0003jn-Lt () code ! kde ! org
[Download RAW message or body]

Git commit 28c75e7d2126211714bf46d31f4ac9c3403e4ba9 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 10/10/2018 at 20:05.
Pushed by rempt into branch 'master'.

Make Move Selection action work only on the outline of the selection

This is a test patch for an idea suggested by David Revoy. Now move
action doesn't work when the cursor is completely inside the selected
area. Move action triggers only when one hovers near the outline itself.

Ref T9486
CC:kimageshop@kde.org

M  +12   -5    libs/ui/tool/kis_tool_select_base.h

https://commits.kde.org/krita/28c75e7d2126211714bf46d31f4ac9c3403e4ba9

diff --git a/libs/ui/tool/kis_tool_select_base.h b/libs/ui/tool/kis_tool_select_base.h
index 85eefc1a4ec..3c315ad9d2d 100644
--- a/libs/ui/tool/kis_tool_select_base.h
+++ b/libs/ui/tool/kis_tool_select_base.h
@@ -252,12 +252,19 @@ public:
 
         KisSelectionSP selection = canvas->viewManager()->selection();
         if (selection &&
-            selection->outlineCacheValid() &&
-            selection->outlineCache().contains(pos)) {
+            selection->outlineCacheValid()) {
 
-            KisNodeSP parent = selection->parentNode();
-            if (parent && parent->isEditable()) {
-                return parent;
+            const int handleRadius = this->handleRadius();
+            QPainterPath samplePath;
+            samplePath.addEllipse(pos, handleRadius, handleRadius);
+
+            const QPainterPath selectionPath = selection->outlineCache();
+
+            if (selectionPath.intersects(samplePath) && !selectionPath.contains(samplePath)) {
+                KisNodeSP parent = selection->parentNode();
+                if (parent && parent->isEditable()) {
+                    return parent;
+                }
             }
         }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic