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 | |
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')
-rw-r--r-- | iosApp/iosApp/Shared/Constants.swift | 19 | ||||
-rw-r--r-- | iosApp/iosApp/Shared/MarkerTransformations.swift | 19 | ||||
-rw-r--r-- | iosApp/iosApp/Shared/OfflineBanner.swift | 27 |
3 files changed, 65 insertions, 0 deletions
diff --git a/iosApp/iosApp/Shared/Constants.swift b/iosApp/iosApp/Shared/Constants.swift new file mode 100644 index 0000000..de82b0b --- /dev/null +++ b/iosApp/iosApp/Shared/Constants.swift @@ -0,0 +1,19 @@ +// +// Constants.swift +// iosApp +// +// Created by Ivan Avalos on 21/09/23. +// Copyright © 2023 orgName. All rights reserved. +// + +import Foundation +import UIKit + +struct Constants { + static var markerSize = 14.0 * UIScreen.main.scale + static var vertexsize = 8.0 * UIScreen.main.scale + static var markerLabelTextSize = UIFont.smallSystemFontSize + static var geofenceLabelTextSize = UIFont.smallSystemFontSize + static var geofenceLineWidth = 4.0 * UIScreen.main.scale + static var reportLineWidth = 4.0 * UIScreen.main.scale +} 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 + } } diff --git a/iosApp/iosApp/Shared/OfflineBanner.swift b/iosApp/iosApp/Shared/OfflineBanner.swift new file mode 100644 index 0000000..f29ab7d --- /dev/null +++ b/iosApp/iosApp/Shared/OfflineBanner.swift @@ -0,0 +1,27 @@ +// +// OfflineBanner.swift +// iosApp +// +// Created by Ivan Avalos on 17/09/23. +// Copyright © 2023 orgName. All rights reserved. +// + +import SwiftUI + +struct OfflineBanner: View { + var body: some View { + Group { + Text("offline") + .foregroundColor(.white) + .padding(5) + } + .frame(minWidth: 0, maxWidth: .infinity) + .background(Color.red) + } +} + +struct OfflineBanner_Previews: PreviewProvider { + static var previews: some View { + OfflineBanner() + } +} |