lottie: fix text range selector translation

Scaling the entire scene caused unintended scaling
of the translation in the text range selector.
This commit is contained in:
Mira Grudzinska 2024-10-29 11:23:47 +07:00 committed by Hermet Park
parent a851d1706e
commit 16111bf55b

View file

@ -1063,7 +1063,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo)
if (!text->ranges.empty()) { if (!text->ranges.empty()) {
Point scaling = {1.0f, 1.0f}; Point scaling = {1.0f, 1.0f};
auto rotation = 0.0f; auto rotation = 0.0f;
auto translation = cursor; Point translation = {0.0f, 0.0f};
//text range process //text range process
for (auto s = text->ranges.begin(); s < text->ranges.end(); ++s) { for (auto s = text->ranges.begin(); s < text->ranges.end(); ++s) {
@ -1100,7 +1100,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo)
} }
Matrix matrix; Matrix matrix;
identity(&matrix); identity(&matrix);
translate(&matrix, translation.x, translation.y); translate(&matrix, translation.x / scale + cursor.x, translation.y / scale + cursor.y);
tvg::scale(&matrix, scaling.x, scaling.y); tvg::scale(&matrix, scaling.x, scaling.y);
rotate(&matrix, rotation); rotate(&matrix, rotation);
shape->transform(matrix); shape->transform(matrix);