diff options
author | Iván Ávalos <avalos@disroot.org> | 2023-09-26 19:36:27 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2023-09-26 19:36:27 -0600 |
commit | 3e72d9b02e864f4f79ae494c67418031b7625659 (patch) | |
tree | 3d6d7ae3997b9372d50932e0e489dced12e5b07c /iosApp/iosApp/Shared/MarkerTransformations.swift | |
parent | 8765d82d3ad055945c6221e4f46bc38d903bf58d (diff) | |
parent | 3022b877d0cf9b7546c80953237c7bca5a4afa50 (diff) | |
download | etbsa-trackermap-mobile-3e72d9b02e864f4f79ae494c67418031b7625659.tar.gz etbsa-trackermap-mobile-3e72d9b02e864f4f79ae494c67418031b7625659.tar.bz2 etbsa-trackermap-mobile-3e72d9b02e864f4f79ae494c67418031b7625659.zip |
Merge branch 'main' of https://git.sr.ht/~avalos/trackermap-mobile
Diffstat (limited to 'iosApp/iosApp/Shared/MarkerTransformations.swift')
-rw-r--r-- | iosApp/iosApp/Shared/MarkerTransformations.swift | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/iosApp/iosApp/Shared/MarkerTransformations.swift b/iosApp/iosApp/Shared/MarkerTransformations.swift index 7291a58..57aa36e 100644 --- a/iosApp/iosApp/Shared/MarkerTransformations.swift +++ b/iosApp/iosApp/Shared/MarkerTransformations.swift @@ -51,4 +51,23 @@ class MarkerTransformations { } return imageName } + + static let STEP = Float.pi / 8 + + static func angleToImageName(rad: Float) -> String { + var imageName: String + switch rad { + case 0.0 ..< STEP: imageName = "Angle0" + case STEP ..< STEP * 3: imageName = "Angle45" + case STEP * 3 ..< STEP * 5: imageName = "Angle90" + case STEP * 5 ..< STEP * 7: imageName = "Angle135" + case STEP * 7 ..< STEP * 9: imageName = "Angle180" + case STEP * 9 ..< STEP * 11: imageName = "Angle225" + case STEP * 11 ..< STEP * 13: imageName = "Angle270" + case STEP * 13 ..< STEP * 15: imageName = "Angle315" + case STEP * 15 ..< STEP * 16: imageName = "Angle0" + default: imageName = angleToImageName(rad: Float.pi * 2 + rad) + } + return imageName + } } |