15#include <klocalizedstring.h>
23, m_originalPosition(pos)
26, m_segmentParam(segmentParam)
27, m_pointData1(segment)
28, m_pointData2(segment)
37 const qreal
eps = 1e-2;
76 QPointF delta = localPos - lastLocalPos;
78 std::tie(move2, move1) =
114 if (hasControlPoint2) {
117 if (hasControlPoint1) {
The undo / redo command for path point moving.
void redo() override
redo the command
Describe a KoPathPoint by a KoPathShape and its indices.
KoPathPointIndex pointIndex
position of the point in the path shape
KoPathShape * pathShape
path shape the path point belongs too
@ ControlPoint2
the second control point
@ ControlPoint1
the first control point
KUndo2Command * createCommand() override
KoPathSegmentChangeStrategy(KoPathTool *tool, const QPointF &pos, const KoPathPointData &segment, qreal segmentParam)
~KoPathSegmentChangeStrategy() override
KoPathTool * m_tool
pointer to the path tool
KoPathPointData m_pointData2
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override
KoPathPointData m_pointData1
int m_originalSegmentDegree
void finishInteraction(Qt::KeyboardModifiers modifiers) override
The undo / redo command for changing segments to curves/lines.
void redo() override
redo the command
A KoPathSegment consist of two neighboring KoPathPoints.
int degree() const
Returns the degree of the segment: 1 = line, 2 = quadratic, 3 = cubic, -1 = invalid.
static KoPathSegment interpolate(const QPointF &p0, const QPointF &p1, const QPointF &p2, qreal t)
bool isValid() const
Returns if segment is valid, e.g. has two valid points.
QList< QPointF > controlPoints() const
Returns ordered list of control points.
virtual QPointF normalize()
Normalizes the path data.
KoPathSegment segmentByIndex(const KoPathPointIndex &pointIndex) const
Returns the segment specified by a path point index.
KoPathPointIndex pathPointIndex(const KoPathPoint *point) const
Returns the path point index of a given path point.
QPointF documentToShape(const QPointF &point) const
Transforms point from document coordinates to shape coordinates.
QPointF snap(const QPointF &mousePosition, Qt::KeyboardModifiers modifiers)
snaps the mouse position, returns if mouse was snapped
KUndo2MagicString kundo2_i18n(const char *text)
std::pair< QPointF, QPointF > offsetSegment(qreal t, const QPointF &offset)
moves point t of the curve by offset offset