25#include <klocalizedstring.h>
96 qreal currentAngle = atan2(edge.y(), edge.x()) /
M_PI * 180;
103 m_isMirrored = (top.x() * left.y() - top.y() * left.x()) < 0.0;
109 QPointF shearVector = point -
m_start;
113 shearVector = m.map(shearVector);
115 qreal shearX = 0, shearY = 0;
118 shearVector = - shearVector;
133 const qreal maxSaneShear = 1e6;
134 if ((qAbs(shearX) == 0.0 && qAbs(shearY) == 0.0) ||
135 qAbs(shearX) > maxSaneShear ||
136 qAbs(shearY) > maxSaneShear) {
144 matrix.shear(shearX, shearY);
170 const bool nothingChanged =
172 newTransforms.begin(),
173 [] (
const QTransform &t1,
const QTransform &t2) {
174 return KisAlgebra2D::fuzzyMatrixCompare(t1, t2, 1e-6);
178 if (!nothingChanged) {
void setText(const KUndo2MagicString &text)
QRectF outlineRect() const override
QSizeF size() const override
Get the size of the shape in pt.
const QList< KoShape * > selectedEditableShapes() const
QPointF absolutePosition(KoFlake::AnchorPosition anchor=KoFlake::Center) const
void applyAbsoluteTransformation(const QTransform &matrix)
virtual QRectF boundingRect() const
Get the bounding box of the shape.
QTransform absoluteTransformation() const
QTransform transformation() const
Returns the shapes local transformation matrix.
virtual void updateAbsolute(const QRectF &rect) const
ShapeShearStrategy(KoToolBase *tool, KoSelection *selection, const QPointF &clicked, KoFlake::SelectionHandle direction)
qreal m_initialSelectionAngle
QList< KoShape * > m_transformedShapesAndSelection
KUndo2Command * createCommand() override
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override
QList< QTransform > m_oldTransforms
void paint(QPainter &painter, const KoViewConverter &converter) override
KUndo2MagicString kundo2_i18n(const char *text)
SelectionHandle
Enum determining which handle is meant, used in KoInteractionTool.
@ BottomRightHandle
The handle that is at the bottom right of a selection.
@ BottomLeftHandle
The handle that is at the bottom left of a selection.
@ RightMiddleHandle
The handle that is at the right - center of a selection.
@ TopRightHandle
The handle that is at the top - right of a selection.
@ TopLeftHandle
The handle that is at the top left of a selection.
@ LeftMiddleHandle
The handle that is at the left center of a selection.
@ TopMiddleHandle
The handle that is at the top - center of a selection.
@ BottomMiddleHandle
The handle that is at the bottom center of a selection.