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

Commit

Permalink
Address feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-guerra committed Apr 9, 2019
1 parent a8767b8 commit b9eb168
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Examples/Examples.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern NSString *const MBXExampleFeatureSelection;
extern NSString *const MBXExampleHeatmap;
extern NSString *const MBXExampleImageAnnotation;
extern NSString *const MBXExampleImageSource;
extern NSString *const MBXExampleLabelPlacement;
extern NSString *const MBXExampleLineAnnotationGeoJSON;
extern NSString *const MBXExampleLineStyleLayer;
extern NSString *const MBXExampleLiveData;
Expand All @@ -62,7 +63,6 @@ extern NSString *const MBXExampleUserLocationAnnotation;
extern NSString *const MBXExampleUserTrackingModes;
extern NSString *const MBXExampleWebAPIData;
extern NSString *const MBXExampleMissingIcons;
extern NSString *const MBXExampleLabelPlacement;

@interface Examples : NSObject

Expand Down
8 changes: 0 additions & 8 deletions Examples/ObjectiveC/Headers/LabelPlacementExample.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// LabelPlacementExample.h
// Examples
//
// Created by Fabian Guerra Soto on 4/2/19.
// Copyright © 2019 Mapbox. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
Expand Down
9 changes: 6 additions & 3 deletions Examples/ObjectiveC/LabelPlacementExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ @implementation LabelPlacementExample
- (void)viewDidLoad {
[super viewDidLoad];

// TODO: This is a test case, it should be changed to fulfill an ios example spec.
self.mapView = [[MGLMapView alloc] initWithFrame: CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

Expand All @@ -27,14 +28,16 @@ - (void)viewDidLoad {
}

- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style {
// poi-label symbol style layer is specific to mapbox-streets-v8
// https://docs.mapbox.com/vector-tiles/reference/mapbox-streets-v8/#poi_labe
MGLSymbolStyleLayer *poiLabelLayers = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:@"poi-label"];
poiLabelLayers.textAnchor = nil;
poiLabelLayers.textOffset = nil;
poiLabelLayers.symbolPlacement = nil;
poiLabelLayers.textOffset = nil;
// poiLabelLayers.textVariableAnchor = [NSExpression expressionForConstantValue:@[@(MGLTextAnchorTop), @(MGLTextAnchorRight)]];
// poiLabelLayers.textRadialOffset = [NSExpression expressionForConstantValue:@(1.2)];
// poiLabelLayers.textJustification = [NSExpression expressionForConstantValue:@(MGLTextJustificationAuto)];
poiLabelLayers.textVariableAnchor = [NSExpression expressionForConstantValue:@[@(MGLTextAnchorTop), @(MGLTextAnchorRight)]];
poiLabelLayers.textRadialOffset = [NSExpression expressionForConstantValue:@(1.2)];
poiLabelLayers.textJustification = [NSExpression expressionForConstantValue:@(MGLTextJustificationAuto)];
}

@end
10 changes: 6 additions & 4 deletions Examples/Swift/LabelPlacementExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LabelPlacementExample: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// TODO: This is a test case, it should be changed to fulfill an ios example spec.
mapView.frame = CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]

Expand All @@ -24,14 +24,16 @@ class LabelPlacementExample: UIViewController {

extension LabelPlacementExample: MGLMapViewDelegate {
func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
// poi-label symbol style layer is specific to mapbox-streets-v8
// https://docs.mapbox.com/vector-tiles/reference/mapbox-streets-v8/#poi_labe
if let poiLabelLayers = style.layer(withIdentifier: "poi-label") as? MGLSymbolStyleLayer {
poiLabelLayers.textAnchor = nil
poiLabelLayers.textOffset = nil
poiLabelLayers.symbolPlacement = nil
poiLabelLayers.textOffset = nil
// poiLabelLayers.textVariableAnchor = NSExpression(forConstantValue: [MGLTextAnchor.top, MGLTextAnchor.right])
// poiLabelLayers.textRadialOffset = NSExpression(forConstantValue: 1.2)
// poiLabelLayers.textJustification = NSExpression(forConstantValue: MGLTextJustification.auto)
poiLabelLayers.textVariableAnchor = NSExpression(forConstantValue: [NSValue(mglTextAnchor: .top), NSValue(mglTextAnchor: .right)])
poiLabelLayers.textRadialOffset = NSExpression(forConstantValue: 1.2)
poiLabelLayers.textJustification = NSExpression(forConstantValue: NSValue(mglTextJustification: .auto))
}
}
}

0 comments on commit b9eb168

Please sign in to comment.