Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Remove shapes fully covered by the gap in the Knife Tool

Agata Cacko0ca51ec075e0
diff --git a/plugins/tools/tool_knife/CutThroughShapeStrategy.cpp b/plugins/tools/tool_knife/CutThroughShapeStrategy.cpp
index ed879d7cb6..e059c45500 100644
--- a/plugins/tools/tool_knife/CutThroughShapeStrategy.cpp
+++ b/plugins/tools/tool_knife/CutThroughShapeStrategy.cpp
@@ -164,7 +164,6 @@ void CutThroughShapeStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
for (int i = 0; i < srcOutlines.size(); i++) {
QPainterPath leftPath = srcOutlines[i] & left;
QPainterPath rightPath = srcOutlines[i] & right;
- bool nonEmptyShapeExists = false;
QList<QPainterPath> paths;
paths << leftPath << rightPath;
@@ -197,13 +196,12 @@ void CutThroughShapeStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
tool()->canvas()->shapeController()->addShapeDirect(shape, parent, cmd);
newSelectedShapes << shape;
- nonEmptyShapeExists = true;
}
- if (nonEmptyShapeExists) {
- shapesToRemove << m_selectedShapes[i];
- }
+ // that happens no matter if there was any non-empty shape
+ // because if there is none, maybe they just were underneath the gap
+ shapesToRemove << m_selectedShapes[i];
}