Skip to content

Commit

Permalink
Allow changing color of scalebar on iOS (#2614)
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseCrocker authored Jul 15, 2024
1 parent 1ae14a5 commit 3b19112
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MapLibre welcomes participation and contributions from everyone. Please read [`C

## main

- Allow changing color of scalebar on iOS ([#2614](https://github.com/maplibre/maplibre-native/pull/2614)).
- Experimental API to toggle tile cache in map view ([#2590](https://github.com/maplibre/maplibre-native/pull/2590)). This can reduce memory usage at the cost of having to parse tile data again when the zoom level changes.

## 6.5.1
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/bazel/files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ MLN_IOS_SDK_HEADERS = [
"src/MLNUserLocation.h",
"src/MLNUserLocationAnnotationView.h",
"src/MLNUserLocationAnnotationViewStyle.h",
"src/MLNScaleBar.h",
]

MLN_IOS_PUBLIC_HEADERS = [
Expand All @@ -27,7 +28,6 @@ MLN_IOS_PRIVATE_HEADERS = [
"src/MLNMapAccessibilityElement.h",
"src/UIViewController+MLNAdditions.h",
"src/UIView+MLNAdditions.h",
"src/MLNScaleBar.h",
"src/MLNFaux3DUserLocationAnnotationView.h",
"src/MLNUserLocationHeadingBeamLayer.h",
"src/MLNAnnotationContainerView.h",
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/sdk-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
"MLNTilePyramidOfflineRegion.h": "platform/darwin/src/MLNTilePyramidOfflineRegion.h",
"MLNVectorTileSource.h": "platform/darwin/src/MLNVectorTileSource.h",
"MLNOfflineStorage.h": "platform/darwin/src/MLNOfflineStorage.h",
"MLNScaleBar.h": "platform/ios/src/MLNScaleBar.h",
"MLNMapView.h": "platform/ios/src/MLNMapView.h",
"Mapbox/Mapbox.h": "platform/ios/src/Mapbox.h"
},
Expand Down Expand Up @@ -238,7 +239,6 @@
"MLNLoggingConfiguration_Private.h": "platform/darwin/src/MLNLoggingConfiguration_Private.h",
"NSComparisonPredicate+MLNAdditions.h": "platform/darwin/src/NSComparisonPredicate+MLNAdditions.h",
"MLNMapAccessibilityElement.h": "platform/ios/src/MLNMapAccessibilityElement.h",
"MLNScaleBar.h": "platform/ios/src/MLNScaleBar.h",
"MMEDate.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEDate.h",
"NSString+MLNAdditions.h": "platform/darwin/src/NSString+MLNAdditions.h",
"UIDevice+MLNAdditions.h": "platform/ios/src/UIDevice+MLNAdditions.h",
Expand Down
3 changes: 2 additions & 1 deletion platform/ios/src/MLNMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@class MLNMapProjection;
@class MLNPolyline;
@class MLNPolygon;
@class MLNScaleBar;
@class MLNShape;

@protocol MLNMapViewDelegate;
Expand Down Expand Up @@ -295,7 +296,7 @@ MLN_EXPORT
A control indicating the scale of the map. The scale bar is positioned in the
upper-left corner. Enable the scale bar via `showsScale`.
*/
@property (nonatomic, readonly) UIView *scaleBar;
@property (nonatomic, readonly) MLNScaleBar *scaleBar;

/**
Sets whether the scale uses styles that make it easier to read on a dark styled map
Expand Down
6 changes: 6 additions & 0 deletions platform/ios/src/MLNScaleBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
// Sets whether the scale uses metric
@property (nonatomic, assign) BOOL usesMetricSystem;

// Sets the primary color of the scale bar
@property (nonatomic) UIColor *primaryColor;

// Sets the secondary color of the scale bar
@property (nonatomic) UIColor *secondaryColor;

@end
2 changes: 0 additions & 2 deletions platform/ios/src/MLNScaleBar.mm
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ @interface MLNScaleBar()
@property (nonatomic) UIView *containerView;
@property (nonatomic) MLNDistanceFormatter *formatter;
@property (nonatomic, assign) MLNRow row;
@property (nonatomic) UIColor *primaryColor;
@property (nonatomic) UIColor *secondaryColor;
@property (nonatomic, assign) CGFloat borderWidth;
@property (nonatomic) NSMutableDictionary* labelImageCache;
@property (nonatomic) MLNScaleBarLabel* prototypeLabel;
Expand Down

0 comments on commit 3b19112

Please sign in to comment.