Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Test against the selection range start when setting text color/stroke.

Wolthera van Hövell tot Westerflier30890a6ca370
diff --git a/plugins/tools/svgtexttool/SvgTextCursor.cpp b/plugins/tools/svgtexttool/SvgTextCursor.cpp
index 62ad8f0e60..e35508c02b 100644
--- a/plugins/tools/svgtexttool/SvgTextCursor.cpp
+++ b/plugins/tools/svgtexttool/SvgTextCursor.cpp
@@ -1306,7 +1306,7 @@ void SvgTextCursor::canvasResourceChanged(int key, const QVariant &value)
return;
KoSvgTextProperties props;
- KoSvgTextProperties shapeProps = hasSelection()? d->shape->propertiesForPos(d->pos, true): d->shape->textProperties();
+ KoSvgTextProperties shapeProps = hasSelection()? d->shape->propertiesForPos(qMin(d->pos, d->anchor), true): d->shape->textProperties();
if (key == KoCanvasResource::ForegroundColor) {
QSharedPointer<KoShapeBackground> bg(new KoColorBackground(value.value<KoColor>().toQColor()));
if (!bg->compareTo(shapeProps.background().data())
@@ -2121,7 +2121,7 @@ void SvgTextCursor::updateCanvasResources()
// Only update canvas resources when there's no selection.
// This relies on Krita not setting anything on the text when there's no selection.
if (d->shape && d->canvas->resourceManager() && d->pos == d->anchor) {
- KoSvgTextProperties props = hasSelection()? d->shape->propertiesForPos(d->pos, true): d->shape->textProperties();
+ KoSvgTextProperties props = hasSelection()? d->shape->propertiesForPos(qMin(d->pos, d->anchor), true): d->shape->textProperties();
KoColorBackground *bg = dynamic_cast<KoColorBackground *>(props.background().data());
if (bg && props.hasProperty(KoSvgTextProperties::FillId)) {
KoColor c;