Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 57c03c6c authored by Thorsten Zachmann's avatar Thorsten Zachmann

Fix painting artefacts after snapping has be used.

Update the position the snap is shown before and after moving.
Reset the data once the action is finished.
Update the canvas when the interaction is finished so the snap guid is no longer visible.

OK to backport?

BUG: 260418
parent 854da8af
......@@ -124,6 +124,12 @@ KUndo2Command* ShapeMoveStrategy::createCommand()
return new KoShapeMoveCommand(m_selectedShapes, m_previousPositions, m_newPositions);
}
void ShapeMoveStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
{
Q_UNUSED(modifiers);
tool()->canvas()->updateCanvas(tool()->canvas()->snapGuide()->boundingRect());
}
void ShapeMoveStrategy::paint( QPainter &painter, const KoViewConverter &converter)
{
SelectionDecorator decorator (KoFlake::NoHandle, false, false);
......
......@@ -48,7 +48,7 @@ public:
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
KUndo2Command* createCommand();
void finishInteraction( Qt::KeyboardModifiers modifiers ) { Q_UNUSED( modifiers ); }
void finishInteraction(Qt::KeyboardModifiers modifiers);
virtual void paint( QPainter &painter, const KoViewConverter &converter);
virtual void handleCustomEvent( KoPointerEvent * event );
private:
......
......@@ -97,7 +97,9 @@ ShapeResizeStrategy::ShapeResizeStrategy(KoToolBase *tool,
void ShapeResizeStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModifiers modifiers)
{
tool()->canvas()->updateCanvas(tool()->canvas()->snapGuide()->boundingRect());
QPointF newPos = tool()->canvas()->snapGuide()->snap( point, modifiers );
tool()->canvas()->updateCanvas(tool()->canvas()->snapGuide()->boundingRect());
bool keepAspect = modifiers & Qt::ShiftModifier;
foreach(KoShape *shape, m_selectedShapes)
......@@ -236,6 +238,7 @@ void ShapeResizeStrategy::resizeBy( const QPointF &center, qreal zoomX, qreal zo
KUndo2Command* ShapeResizeStrategy::createCommand()
{
tool()->canvas()->snapGuide()->reset();
QList<QSizeF> newSizes;
QList<QTransform> transformations;
const int shapeCount = m_selectedShapes.count();
......@@ -250,6 +253,12 @@ KUndo2Command* ShapeResizeStrategy::createCommand()
return cmd;
}
void ShapeResizeStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
{
Q_UNUSED(modifiers);
tool()->canvas()->updateCanvas(tool()->canvas()->snapGuide()->boundingRect());
}
void ShapeResizeStrategy::paint( QPainter &painter, const KoViewConverter &converter)
{
SelectionDecorator decorator (KoFlake::NoHandle, false, false);
......
......@@ -46,7 +46,7 @@ public:
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
KUndo2Command* createCommand();
void finishInteraction( Qt::KeyboardModifiers modifiers ) { Q_UNUSED(modifiers); }
void finishInteraction(Qt::KeyboardModifiers modifiers);
virtual void paint( QPainter &painter, const KoViewConverter &converter);
virtual void handleCustomEvent( KoPointerEvent * event );
private:
......
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