[krita] libs/ui/tool: Make Move Selection action work only on the outline of the selection
Boudewijn Rempt
null at kde.org
Wed Oct 10 21:05:41 BST 2018
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 at 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;
+ }
}
}
More information about the kimageshop
mailing list