Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Expose styling options for the user location annotation. #403

Merged
merged 7 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename struct to clarify purpose
  • Loading branch information
fabian-guerra committed Sep 2, 2020
commit d349291ff76f6dd8eac2f8d945bb0f005beecd0b
4 changes: 2 additions & 2 deletions platform/ios/app/MBXViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2368,8 +2368,8 @@ - (void)mapView:(nonnull MGLMapView *)mapView didChangeLocationManagerAuthorizat
}
}

- (MGLUserLocationStyle)mapViewStyleForDefaultUserLocationAnnotationView:(MGLMapView *)mapView {
MGLUserLocationStyle style;
- (MGLUserLocationAnnotationViewStyle)mapViewStyleForDefaultUserLocationAnnotationView:(MGLMapView *)mapView {
MGLUserLocationAnnotationViewStyle style;

style.approximateHaloFillColor = UIColor.redColor;
style.approximateHaloOpacity = 0.15;
Expand Down
6 changes: 3 additions & 3 deletions platform/ios/src/MGLFaux3DUserLocationAnnotationView.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ - (void)drawPuck


if ([self.mapView.delegate respondsToSelector:@selector(mapViewStyleForDefaultUserLocationAnnotationView:)]) {
MGLUserLocationStyle style = [self.mapView.delegate mapViewStyleForDefaultUserLocationAnnotationView:self.mapView];
MGLUserLocationAnnotationViewStyle style = [self.mapView.delegate mapViewStyleForDefaultUserLocationAnnotationView:self.mapView];
arrowColor = style.puckArrowFillColor ? style.puckArrowFillColor : arrowColor;
puckShadowColor = style.puckShadowColor ? style.puckShadowColor : puckShadowColor;
shadowOpacity = style.puckShadowOpacity;
Expand Down Expand Up @@ -284,7 +284,7 @@ - (void)drawDot


if ([self.mapView.delegate respondsToSelector:@selector(mapViewStyleForDefaultUserLocationAnnotationView:)]) {
MGLUserLocationStyle style = [self.mapView.delegate mapViewStyleForDefaultUserLocationAnnotationView:self.mapView];
MGLUserLocationAnnotationViewStyle style = [self.mapView.delegate mapViewStyleForDefaultUserLocationAnnotationView:self.mapView];
haloColor = style.haloFillColor ? style.haloFillColor : haloColor;
puckBackgroundColor = style.puckFillColor ? style.puckFillColor : puckBackgroundColor;
puckShadowColor = style.puckShadowColor ? style.puckShadowColor : puckShadowColor;
Expand Down Expand Up @@ -525,7 +525,7 @@ - (void)drawApproximate
CGFloat opacity = 0.25;

if ([self.mapView.delegate respondsToSelector:@selector(mapViewStyleForDefaultUserLocationAnnotationView:)]) {
MGLUserLocationStyle style = [self.mapView.delegate mapViewStyleForDefaultUserLocationAnnotationView:self.mapView];
MGLUserLocationAnnotationViewStyle style = [self.mapView.delegate mapViewStyleForDefaultUserLocationAnnotationView:self.mapView];
backgroundColor = style.approximateHaloFillColor ? style.approximateHaloFillColor : backgroundColor;
strokeColor = style.approximateHaloBorderColor ? style.approximateHaloBorderColor : strokeColor;
opacity = style.approximateHaloOpacity;
Expand Down
4 changes: 2 additions & 2 deletions platform/ios/src/MGLMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLUserLocationAnnotationTyp
/**
A structure containing information about the default User Location annotation view style.
*/
typedef struct __attribute__((objc_boxable)) MGLUserLocationStyle {
typedef struct __attribute__((objc_boxable)) MGLUserLocationAnnotationViewStyle {
/**
The puck's view fill color.
*/
Expand Down Expand Up @@ -176,7 +176,7 @@ typedef struct __attribute__((objc_boxable)) MGLUserLocationStyle {
*/
CGFloat approximateHaloOpacity;

} MGLUserLocationStyle;
} MGLUserLocationAnnotationViewStyle;

/**
An interactive, customizable map view with an interface similar to the one
Expand Down
8 changes: 4 additions & 4 deletions platform/ios/src/MGLMapViewDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,16 @@ NS_ASSUME_NONNULL_BEGIN
views for each `MGLMapView.userTrackingMode`.

When using this delegate set the following constants to a default value:
`MGLUserLocationStyle.puckShadowOpacity` = `0.25`
`MGLUserLocationStyle.approximateHaloOpacity` = `0.25`
`MGLUserLocationStyle.approximateHaloBorderWidth` = `2.0`
`MGLUserLocationAnnotationViewStyle.puckShadowOpacity` = `0.25`
`MGLUserLocationAnnotationViewStyle.approximateHaloOpacity` = `0.25`
`MGLUserLocationAnnotationViewStyle.approximateHaloBorderWidth` = `2.0`

This method is called many times during gesturing, so you should avoid performing
complex or performance-intensive tasks in your implementation.

@param mapView The map view that is tracking the user’s location.
*/
- (MGLUserLocationStyle)mapViewStyleForDefaultUserLocationAnnotationView:(MGLMapView *)mapView;
- (MGLUserLocationAnnotationViewStyle)mapViewStyleForDefaultUserLocationAnnotationView:(MGLMapView *)mapView;

/**
Tells the delegate that the location of the user was updated.
Expand Down