28 outline = outline.toReversed();
34 percent = fmod(percent, 1.0);
36 percent = qBound(0.0, percent, 1.0);
38 line.setP1(outline.pointAtPercent(percent));
39 line.setAngle(outline.angleAtPercent(percent) - 90);
40 line.setLength(lineLength);
67 d->handleRadius = radius;
72 d->decorationThickness = thickness;
77 if (!
d->shape)
return false;
80 QPointF handleInPts = viewToDocument.map(QPointF(
d->handleRadius,
d->handleRadius));
82 QLineF line =
d->getLineAnchorTextNode(index, handleInPts.x()*2);
83 line =
d->shape->absoluteTransformation().map(line);
84 bool hit = (QLineF(line.p2(), mouseInPts).length() <= handleInPts.x()*2);
91 if (!
d->shape)
return;
95 QPointF handleInPts = converter.
viewToDocument().map(QPointF(
d->handleRadius,
d->handleRadius));
96 QLineF line =
d->getLineAnchorTextNode(index, handleInPts.x()*3);
103 }
else if (
d->isHovered) {
118 if (!
d->shape)
return r;
121 QPointF handleInPts = documentToView.inverted().map(QPointF(
d->handleRadius,
d->handleRadius));
123 QLineF line =
d->getLineAnchorTextNode(index, handleInPts.x()*3);
125 line = QTransform(
d->shape->absoluteTransformation()*documentToView).map(line);
126 r |= QRectF(line.p1()-QPointF(
d->decorationThickness,
d->decorationThickness)
127 , line.p2()+QPointF(
d->decorationThickness,
d->decorationThickness));
129 QPointF handle(
d->handleRadius,
d->handleRadius);
130 r |= QRectF(line.p2() - handle, line.p2() + handle);
138 d->isActive = isActive;
The KisHandlePainterHelper class is a special helper for painting handles around objects....
void drawConnectionLine(const QLineF &line)
void setHandleStyle(const KisHandleStyle &style)
void drawHandleCircle(const QPointF ¢er, qreal radius)
static KisHandleStyle & highlightedPrimaryHandles()
static KisHandleStyle & selectedPrimaryHandles()
static KisHandleStyle & primarySelection()
The position of a path point within a path shape.
bool isClosedSubpath(int subpathIndex) const
Checks if a subpath is closed.
QPainterPath outline() const override
reimplemented
int subpathCount() const
Returns the number of subpaths in the path.
static KisHandlePainterHelper createHandlePainterHelperView(QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius=0.0, int decorationThickness=1)
QTransform transformation() const
Returns the shapes local transformation matrix.
The KoSvgTextNodeIndex class.
KoShape * textPath()
textPath
KoSvgText::TextOnPathInfo * textPathInfo()
textPathInfo the text path info for this node as a pointer.
virtual QPointF viewToDocument(const QPointF &viewPoint) const
QScopedPointer< Private > d
QRectF decorationRect(const QTransform documentToView) const
decorationRect
void setShape(KoSvgTextShape *shape)
setShape Set the shape for which to draw the text path.
void paint(QPainter *painter, const KoViewConverter &converter)
paint Paint the handles for the text path.
bool hitTest(QPointF mouseInPts, const QTransform viewToDocument)
hitTest
~SvgTextOnPathDecorationHelper()
SvgTextOnPathDecorationHelper()
void setStrategyActive(bool isActive)
void setHandleRadius(qreal radius)
void setDecorationThickness(qreal thickness)
void setPos(int pos)
setPos the the position of the cursor, where the text path is sought. A single text shape can have mu...
bool startOffsetIsPercentage
qreal decorationThickness
QLineF getLineAnchorTextNode(KoSvgTextNodeIndex &index, qreal lineLength)