For interactions that are undo-able this method should be implemented to return such a command. Implementations should return 0 otherwise.
Used to synchronise the offsets when changing fontsize...
69{
72
74 if (originalTf.isEmpty()) return nullptr;
75
80
82 } else {
87
88 if (infos.empty()) return cmd;
89
91 const QTransform tf = QTransform::fromTranslate(info.
finalPos.x(), info.
finalPos.y()) * QTransform().rotate(info.
rotateDeg);
92 const QLineF line = tf.map(QLineF(QPointF(), info.
advance));
94
97
101
104 const qreal
scale = qMax(0.000001, distNew/distOld);
108
110
111
112 QPointF diff = QPointF();
113
115 const QTransform rotate = QTransform().rotate(originalInfo.
rotateDeg);
116 const QPointF newPos = originalInfo.
finalPos + diff;
117 const QTransform oTf = QTransform::fromTranslate(originalInfo.
finalPos.x(), originalInfo.
finalPos.y()) * rotate;
118 diff += (oTf.map(originalInfo.
advance*scale) - oTf.map(originalInfo.
advance));
119 newPositions.append(newPos);
120 newRotations.append(originalInfo.
rotateDeg);
121 }
122 }
125
126 const QLineF normal = line.normalVector();
127 qreal dot = QVector2D::dotProduct(QVector2D(normal.p2() - normal.p1()), QVector2D(dragCurrent-line.p1()));
128 length.value = dot < 0? -distNew: distNew;
134
138 lineHeight.
length.
value = (ascender-descender)+lineGap+lineGap;
141
143 }
147 if (!newPositions.isEmpty()) {
152 } else {
154 }
155 }
156 }
157 return cmd;
158}
qreal metricsMultiplier(const CssQmlUnitConverter::UserUnits type, const KoSvgText::FontMetrics metrics, const qreal fontSize, const qreal percentageReference)
qreal length(const QPointF &vec)
void setText(const KUndo2MagicString &text)
KUndo2MagicString text() const
QPointF documentToShape(const QPointF &point) const
Transforms point from document coordinates to shape coordinates.
@ BaselineShiftValueId
Double.
@ LineHeightId
KoSvgText::AutoValue.
@ BaselineShiftModeId
KoSvgText::BaselineShiftMode.
void setFontSize(const KoSvgText::CssLengthPercentage length)
void setProperty(PropertyId id, const QVariant &value)
QVariant propertyOrDefault(PropertyId id) const
KoSvgText::CssLengthPercentage fontSize() const
@ PreformattedText
Text-on-Path falls under this or PrePositionedText depending on collapse of lines.
KoSvgTextProperties propertiesForPos(const int pos, bool inherited=false) const
Return the properties at a given position.
TextType textType() const
textType This enum gives an indication of what kind of text this shape is. The different text types a...
QList< KoSvgTextCharacterInfo > getPositionsAndRotationsForRange(const int startPos, const int endPos) const
getPositionsAndRotationsForRange
The SvgTextMergePropertiesRangeCommand class This sets properties on a specific range in a single tex...
qreal kisDistanceToLine(const QPointF &m, const QLineF &line)
@ ShiftLengthPercentage
Css Length Percentage, percentage is lh.
The KoSvgTextCharacterInfo class This is a small struct to convey information about character positio...
KoSvgText::FontMetrics metrics
<Whether the character is in the middle of a cluster.
qint32 fontSize
Currently set size, CSS unit 'em'.
qint32 descender
distance for origin to bottom.
qint32 ascender
distance from origin to top.
bool isNumber
Length or number.
CssLengthPercentage length
bool isNormal
It's a number indicating the lineHeight;.
@ BaselineShift
The text properties handles.