@@ -4,28 +4,35 @@ import UIKit
44class AttributionController : NSObject , FLT_SETTINGSAttributionSettingsInterface {
55
66 func updateSettingsSettings( _ settings: FLT_SETTINGSAttributionSettings , error: AutoreleasingUnsafeMutablePointer < FlutterError ? > ) {
7+ var options = mapView. ornaments. options
78 switch settings. position? . value {
89 case . BOTTOM_LEFT:
9- mapView . ornaments . options. attributionButton. position = . bottomLeading
10- mapView . ornaments . options. attributionButton. margins = CGPoint ( x: ( settings. marginLeft? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginBottom? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
10+ options. attributionButton. position = . bottomLeading
11+ options. attributionButton. margins = CGPoint ( x: ( settings. marginLeft? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginBottom? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
1112 case . BOTTOM_RIGHT, . none:
12- mapView . ornaments . options. attributionButton. position = . bottomTrailing
13- mapView . ornaments . options. attributionButton. margins = CGPoint ( x: ( settings. marginRight? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginBottom? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
13+ options. attributionButton. position = . bottomTrailing
14+ options. attributionButton. 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. attributionButton. position = . topLeading
16- mapView . ornaments . options. attributionButton. margins = CGPoint ( x: ( settings. marginLeft? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginTop? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
16+ options. attributionButton. position = . topLeading
17+ options. attributionButton. margins = CGPoint ( x: ( settings. marginLeft? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginTop? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
1718 case . TOP_RIGHT:
18- mapView. ornaments. options. attributionButton. position = . topTrailing
19- mapView. ornaments. options. attributionButton. margins = CGPoint ( x: ( settings. marginRight? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginTop? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
19+ options. attributionButton. position = . topTrailing
20+ options. attributionButton. margins = CGPoint ( x: ( settings. marginRight? . CGFloat ?? 0.0 ) / UIScreen. main. scale, y: ( settings. marginTop? . CGFloat ?? 0.0 ) / UIScreen. main. scale)
21+ }
22+
23+ mapView. ornaments. options = options
24+ if let iconColor = settings. iconColor? . intValue {
25+ mapView. ornaments. attributionButton. tintColor = uiColorFromHex ( rgbValue: iconColor)
2026 }
2127 }
2228
2329 func getSettingsWithError( _ error: AutoreleasingUnsafeMutablePointer < FlutterError ? > ) -> FLT_SETTINGSAttributionSettings ? {
2430 let options = mapView. ornaments. options. attributionButton
2531 let position = getFLT_SETTINGSOrnamentPosition ( position: options. position)
32+ let iconColor = mapView. ornaments. attributionButton. tintColor. rgb ( )
2633
2734 let settings = FLT_SETTINGSAttributionSettings . make (
28- withIconColor: nil ,
35+ withIconColor: NSNumber ( value : iconColor ) ,
2936 position: . init( value: position) ,
3037 marginLeft: NSNumber ( value: options. margins. x * UIScreen. main. scale) ,
3138 marginTop: NSNumber ( value: options. margins. y * UIScreen. main. scale) ,
0 commit comments