@@ -4,36 +4,33 @@ import UIKit
44class CompassController : NSObject , FLT_SETTINGSCompassSettingsInterface {
55
66 func updateSettingsSettings( _ settings: FLT_SETTINGSCompassSettings , error: AutoreleasingUnsafeMutablePointer < FlutterError ? > ) {
7+ var compass = mapView. ornaments. options. compass
78 switch settings. position? . value {
89 case . BOTTOM_LEFT:
9- mapView . ornaments . options . compass. position = . bottomLeading
10- mapView . ornaments . options . compass. margins = CGPoint ( x: ( settings. marginLeft? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginBottom? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
10+ compass. position = . bottomLeading
11+ compass. margins = CGPoint ( x: ( settings. marginLeft? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginBottom? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
1112 case . BOTTOM_RIGHT:
12- mapView . ornaments . options . compass. position = . bottomTrailing
13- mapView . ornaments . options . compass. margins = CGPoint ( x: ( settings. marginRight? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginBottom? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
13+ compass. position = . bottomTrailing
14+ compass. margins = CGPoint ( x: ( settings. marginRight? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginBottom? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
1415 case . TOP_LEFT:
15- mapView . ornaments . options . compass. position = . topLeading
16- mapView . ornaments . options . compass. margins = CGPoint ( x: ( settings. marginLeft? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginTop? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
16+ compass. position = . topLeading
17+ compass. margins = CGPoint ( x: ( settings. marginLeft? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginTop? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
1718 case . TOP_RIGHT, . none:
18- mapView . ornaments . options . compass. position = . topTrailing
19- mapView . ornaments . options . compass. margins = CGPoint ( x: ( settings. marginRight? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginTop? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
19+ compass. position = . topTrailing
20+ compass. margins = CGPoint ( x: ( settings. marginRight? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginTop? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
2021 }
2122
2223 if let data = settings. image? . data {
23- mapView . ornaments . options . compass. image = UIImage ( data: data, scale: UIScreen . main. scale)
24+ compass. image = UIImage ( data: data, scale: UIScreen . main. scale)
2425 }
2526
2627 if let visible = settings. enabled {
2728 if !visible. boolValue {
28- mapView. ornaments. options. compass. visibility = OrnamentVisibility . hidden
29- } else {
30- if settings. fadeWhenFacingNorth? . boolValue ?? true {
31- mapView. ornaments. options. compass. visibility = OrnamentVisibility . adaptive
32- } else {
33- mapView. ornaments. options. compass. visibility = OrnamentVisibility . visible
34- }
29+ compass. visibility = visible. boolValue ? . adaptive : . hidden
3530 }
3631 }
32+
33+ mapView. ornaments. options. compass = compass
3734 }
3835
3936 func getSettingsWithError( _ error: AutoreleasingUnsafeMutablePointer < FlutterError ? > ) -> FLT_SETTINGSCompassSettings ? {
0 commit comments