From 2dea551f33d3181561eeed7bb0d52b9ea2fc492b Mon Sep 17 00:00:00 2001 From: optinn-henrik <151851470+optinn-henrik@users.noreply.github.com> Date: Sun, 14 Apr 2024 10:19:11 +0200 Subject: [PATCH] fix(cropper-viewer): calculate translateY correctly when rotated 90deg (#1152) Fix #1031 --- packages/element-viewer/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/element-viewer/src/index.ts b/packages/element-viewer/src/index.ts index 20ff74f4b..40749ecd8 100644 --- a/packages/element-viewer/src/index.ts +++ b/packages/element-viewer/src/index.ts @@ -224,7 +224,7 @@ export default class CropperViewer extends CropperElement { if ($sourceImage && $image && $scale > 0) { const [a, b, c, d, e, f] = matrix; const translateX = ((x * d) - (c * y)) / ((a * d) - (c * b)); - const translateY = (y - (b * translateX)) / d; + const translateY = ((y * a) - (b * x)) / ((a * d) - (c * b)); const newE = a * translateX + c * translateY + e; const newF = b * translateX + d * translateY + f;