From 144fecc3a1cf316309e0374be780e03c62ee9d23 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Tue, 29 Oct 2024 11:23:47 +0700 Subject: [PATCH] lottie: fix text range selector translation Scaling the entire scene caused unintended scaling of the translation in the text range selector. --- src/loaders/lottie/tvgLottieBuilder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 22a6a5e9..3d8d27b4 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -1063,7 +1063,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo) if (!text->ranges.empty()) { Point scaling = {1.0f, 1.0f}; auto rotation = 0.0f; - auto translation = cursor; + Point translation = {0.0f, 0.0f}; //text range process for (auto s = text->ranges.begin(); s < text->ranges.end(); ++s) { @@ -1098,7 +1098,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo) } auto& matrix = shape->transform(); 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); rotate(&matrix, rotation); shape->transform(matrix);