24 , m_dragStart(regionOfInterest.center())
26 , m_modifiers(modifiers)
27 , m_textData(textShape->getMemento())
52 SvgTextShapeManagerBlocker blocker(
tool()->canvas()->shapeManager());
74 if (originalTf.isEmpty())
return nullptr;
88 if (infos.empty())
return cmd;
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));
104 const qreal scale = qMax(0.000001, distNew/distOld);
112 QPointF diff = QPointF();
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);
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;
138 lineHeight.
length.
value = (ascender-descender)+lineGap+lineGap;
147 if (!newPositions.isEmpty()) {
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
KoToolBase * tool() const
QPointF documentToShape(const QPointF &point) const
Transforms point from document coordinates to shape coordinates.
virtual void updateAbsolute(const QRectF &rect) const
void reset()
Resets the snap guide.
QPointF snap(const QPointF &mousePosition, Qt::KeyboardModifiers modifiers)
snaps the mouse position, returns if mouse was snapped
@ 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
void setMemento(const KoSvgTextShapeMementoSP memento)
Set the text data and layout info, reset listening cursors to 0.
QRectF boundingRect() const override
Get the bounding box of the shape.
@ 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...
KUndo2Command * createCommand() override
void finishInteraction(Qt::KeyboardModifiers modifiers) override
SvgTextTypeSettingStrategy(KoToolBase *tool, KoSvgTextShape *textShape, SvgTextCursor *textCursor, const QRectF ®ionOfInterest, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override
KoSvgTextShapeMementoSP m_textData
Qt::KeyboardModifiers m_modifiers
void cancelInteraction() override
QScopedPointer< KUndo2Command > m_previousCmd
qreal kisDistanceToLine(const QPointF &m, const QLineF &line)
PointType snapToClosestAxis(PointType P)
@ 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;.
int getAnchor()
Get the current selection anchor. This is the same as position, unless there's a selection.
TypeSettingModeHandle
Handles used by type setting mode.
@ BaselineShift
The text properties handles.
int getPos()
Get the current position.
int posForTypeSettingHandleAndRect(const TypeSettingModeHandle handle, const QRectF regionOfInterest)
posForHandleAndRect Returns the closest cursor position for a given region and typesetting handle....
TypeSettingModeHandle typeSettingHandleAtPos(const QRectF regionOfInterest)
Get typeSettingMode handle for text;.