From dd26742d521ef76f206c9bfc25e5900280f12e7e Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 8 Apr 2026 10:22:55 +0200 Subject: [PATCH] screen translator: handle rotated text --- .../modules/ii/screenTranslator/ScreenTextOverlay.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dots/.config/quickshell/ii/modules/ii/screenTranslator/ScreenTextOverlay.qml b/dots/.config/quickshell/ii/modules/ii/screenTranslator/ScreenTextOverlay.qml index 8236fb189..7d87e69f9 100644 --- a/dots/.config/quickshell/ii/modules/ii/screenTranslator/ScreenTextOverlay.qml +++ b/dots/.config/quickshell/ii/modules/ii/screenTranslator/ScreenTextOverlay.qml @@ -274,6 +274,17 @@ Item { property real unscaledY: boundingVertices[0].y property real unscaledWidth: boundingVertices[1].x - boundingVertices[0].x property real unscaledHeight: boundingVertices[3].y - boundingVertices[0].y + + // Calculate rotation based on first two vertices (top-left to top-right) + property real dx: boundingVertices[1].x - boundingVertices[0].x + property real dy: boundingVertices[1].y - boundingVertices[0].y + transformOrigin: Item.TopLeft + rotation: { + // Note rotation in qml is degrees clockwise + var angle = Math.atan2(dy, dx) * 180 / Math.PI; + return angle; + } + x: unscaledX * scaleFactor y: unscaledY * scaleFactor width: unscaledWidth * scaleFactor