forked from Shinonome/dots-hyprland
screen translator: handle rotated text
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user