summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadia Barbosa <nadiabarbosa@me.com>2019-08-29 11:22:24 -0700
committerNadia Barbosa <nadiabarbosa@me.com>2019-08-29 11:30:16 -0700
commitfddb65809a97bd3b6c571385d198a952eee67529 (patch)
treead85640d7e186f24e91e9baebce98a714f3fbd2a
parent544aabd0204235579e99fe4d9b8c2de16f70e897 (diff)
downloadqtlocation-mapboxgl-upstream/ios13-scale-bar.tar.gz
[ios] Allow MGLScaleBar to support dark mode on iOS 13upstream/ios13-scale-bar
Add changelog PR link
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/src/MGLScaleBar.mm6
2 files changed, 7 insertions, 0 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index fae5599439..12215210b0 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -6,6 +6,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Fixed an issue that caused the tilt gesture to trigger too easily and conflict with pinch or pan gestures. ([#15349](https://github.com/mapbox/mapbox-gl-native/pull/15349))
* Fixed a bug with annotation view positions after camera transitions. ([#15122](https://github.com/mapbox/mapbox-gl-native/pull/15122/))
+* Fixed an issue where the scale bar would not update its text color when dark mode was enabled. ([#15524](https://github.com/mapbox/mapbox-gl-native/pull/15524))
### Performance improvements
diff --git a/platform/ios/src/MGLScaleBar.mm b/platform/ios/src/MGLScaleBar.mm
index 993852d8b9..1a29b1aa1c 100644
--- a/platform/ios/src/MGLScaleBar.mm
+++ b/platform/ios/src/MGLScaleBar.mm
@@ -102,6 +102,12 @@ static const CGFloat MGLFeetPerMeter = 3.28084;
- (void)drawTextInRect:(CGRect)rect {
CGSize shadowOffset = self.shadowOffset;
UIColor *textColor = self.textColor;
+
+ if (@available(iOS 13.0, *)) {
+ if (UITraitCollection.currentTraitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
+ textColor = UIColor.blackColor;
+ }
+ }
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2);