Skip to content

Commit 1429ab4

Browse files
committed
src/qml/controls/subtitletext: fix misaligned subtitles
Use anchors for positioning to fix a rare issue where text could come desynced from the stroke layer. This could happen because the top layer would be drawn before the lower layer since Shape is asynchronous. Is it rare transient issue, so this isn't a serious, but it should be fixed. Since anchors update positions in response to geometery changes, this should keep text aligned.
1 parent bbec5c4 commit 1429ab4

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/qml/controls/StrokeLabel.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Item {
5959

6060
Shape {
6161
id: strokeShape
62+
anchors.centerIn: parent
6263
antialiasing: true
6364
layer.enabled: true
6465
layer.samples: 8
@@ -84,8 +85,7 @@ Item {
8485

8586
Shape {
8687
id: textShape
87-
x: root.margin
88-
y: root.margin
88+
anchors.centerIn: strokeShape
8989
antialiasing: true
9090
layer.enabled: true
9191
layer.samples: 8

src/qml/controls/SubtitleText.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Item {
130130

131131
Shape {
132132
id: strokeShape
133+
anchors.centerIn: parent
133134
antialiasing: true
134135
layer.enabled: true
135136
layer.samples: 8
@@ -188,8 +189,7 @@ Item {
188189

189190
Shape {
190191
id: textShape
191-
x: root.margin
192-
y: root.margin
192+
anchors.centerIn: strokeShape
193193
antialiasing: true
194194
layer.enabled: true
195195
layer.samples: 8

0 commit comments

Comments
 (0)