Commit e4f74f1c authored by Tusooa Zhu's avatar Tusooa Zhu

Port KisToolShape to the new-style stroke

parent a3912028
......@@ -52,6 +52,8 @@
#include "kis_selection_mask.h"
#include "kis_shape_selection.h"
#include "kis_processing_applicator.h"
#include <../../opt/krita/src/libs/flake/KoCanvasStrokeHelperBase.h>
#include <../../opt/krita/src/libs/flake/KoCanvasStrokeHelperBase.h>
KisToolShape::KisToolShape(KoCanvasBase * canvas, const QCursor & cursor)
......@@ -212,19 +214,16 @@ void KisToolShape::addShape(KoShape* shape)
}
}
KUndo2Command *parentCommand = new KUndo2Command();
KoSelection *selection = canvas()->selectedShapesProxy()->selection();
const QList<KoShape*> oldSelectedShapes = selection->selectedShapes();
// reset selection on the newly added shape :)
// TODO: think about moving this into controller->addShape?
new KoKeepShapesSelectedCommand(oldSelectedShapes, {shape}, canvas()->selectedShapesProxy(), false, parentCommand);
KUndo2Command *cmd = canvas()->shapeController()->addShape(shape, 0, parentCommand);
parentCommand->setText(cmd->text());
new KoKeepShapesSelectedCommand(oldSelectedShapes, {shape}, canvas()->selectedShapesProxy(), true, parentCommand);
KisProcessingApplicator::runSingleCommandStroke(image(), cmd);
canvas()->strokeHelper()->run(kundo2_i18n("Create shape (new)"),
[selection, shape, this]() {
canvas()->shapeController()->addShape(shape, 0);
selection->deselectAll();
selection->select(shape);
return true;
}
);
}
void KisToolShape::addPathShape(KoPathShape* pathShape, const KUndo2MagicString& name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment