diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2019-05-28 16:19:06 -0700 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2019-05-28 16:19:06 -0700 |
commit | 8ade7e8725f7e10c80bb4d8005546962d2b7af0c (patch) | |
tree | 6237d91ce51cdec8375d9e1efa1bd71f79e69005 | |
parent | 0a7919ee7e1ab0dc10c3dc9662d9d15a29562cac (diff) |
[ios] added repro for 14779
-rw-r--r-- | platform/ios/app/MBXViewController.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 893cee1cd..f05b696a1 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -1066,6 +1066,26 @@ CLLocationCoordinate2D randomWorldCoordinate() { [self.mapView.style addLayer:layer]; } } + + CLLocationCoordinate2D visibleCoordinates[4] = { + self.mapView.visibleCoordinateBounds.ne, + CLLocationCoordinate2DMake(self.mapView.visibleCoordinateBounds.ne.latitude, self.mapView.visibleCoordinateBounds.sw.longitude), + self.mapView.visibleCoordinateBounds.sw, + CLLocationCoordinate2DMake(self.mapView.visibleCoordinateBounds.sw.latitude, self.mapView.visibleCoordinateBounds.ne.longitude) + }; + NSUInteger numberOfCoordinates = sizeof(visibleCoordinates) / sizeof(CLLocationCoordinate2D); + MGLPolygon *shape = [MGLPolygon polygonWithCoordinates:visibleCoordinates count:numberOfCoordinates]; + MGLShapeSource *shapeSource = [[MGLShapeSource alloc] initWithIdentifier:@"visible-coord" shape:shape options:nil]; + [self.mapView.style addSource:shapeSource]; + + MGLFillStyleLayer *shapeLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"visible-coord" source:shapeSource]; + shapeLayer.fillOpacity = [NSExpression expressionForConstantValue:@0.5]; + MGLStyleLayer *annotLayer = [self.mapView.style layerWithIdentifier:@"com.mapbox.annotations.points"]; + if (annotLayer) { + [self.mapView.style insertLayer:shapeLayer belowLayer:annotLayer]; + } else { + [self.mapView.style addLayer:shapeLayer]; + } } - (void)styleWaterLayer |