Skip to content

Commit 1966196

Browse files
committed
Fix ring rotation on 32-bit devices (Fixes #235)
1 parent 7f59b89 commit 1966196

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Authenticator/Source/ProgressRingView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ private class RingLayer: CAShapeLayer {
111111

112112
// Transform the ring path to draw clockwise, starting at the top.
113113
let translationToOrigin = CGAffineTransform(translationX: -ringRect.midX, y: -ringRect.midY)
114-
let rotation = CGAffineTransform(rotationAngle: -.pi / 2)
114+
// Note: The rotation angle is more precisely expressed as `-.pi / 2`, but that causes a bug on 32-bit devices.
115+
// See https://github.com/mattrubin/Authenticator/issues/235 for more details.
116+
let rotation = CGAffineTransform(rotationAngle: -1.5708)
115117
let translationFromOrigin = CGAffineTransform(translationX: ringRect.midX, y: ringRect.midY)
116118
var transform = translationToOrigin.concatenating(rotation).concatenating(translationFromOrigin)
117119
withUnsafePointer(to: &transform) { transform in

0 commit comments

Comments
 (0)