This repository has been archived by the owner on Mar 26, 2021. It is now read-only.
forked from mapbox/mapbox-gl-native
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ios] Add insets and MBXDebugView to visualize insets.
[core] Add insets in CameraOptions and applied them in Transform to endPoint.
- Loading branch information
Larry Geromegnace
committed
Jan 14, 2016
1 parent
3585588
commit 2d7b54e
Showing
7 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// MBXDebugView.h | ||
// ios | ||
// | ||
// Created by Mappy SA on 04/01/2016. | ||
// | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface MBXDebugView : UIView | ||
|
||
@property (nonatomic, assign) UIEdgeInsets insets; | ||
|
||
- (instancetype)initWithFrame:(CGRect)frame andWithInsets:(UIEdgeInsets) insets; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// MBXDebugView.m | ||
// ios | ||
// | ||
// Created by Mappy SA on 04/01/2016. | ||
// | ||
// | ||
|
||
#import "MBXDebugView.h" | ||
|
||
@implementation MBXDebugView | ||
|
||
- (instancetype)initWithFrame:(CGRect)frame andWithInsets:(UIEdgeInsets) insets { | ||
if (self = [super initWithFrame:frame]) { | ||
self.insets = insets; | ||
self.backgroundColor = [UIColor clearColor]; | ||
[self setUserInteractionEnabled:NO]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)drawRect:(__unused CGRect) rect{ | ||
UIEdgeInsets insets = self.insets; | ||
CGContextRef context = UIGraphicsGetCurrentContext(); | ||
CGRect insetsRect = CGRectMake(insets.left, | ||
insets.top, | ||
self.frame.size.width - insets.right - insets.left, | ||
self.frame.size.height - insets.bottom - insets.top); | ||
|
||
UIColor * redColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0]; | ||
|
||
CGContextSetStrokeColorWithColor(context, redColor.CGColor); | ||
CGContextStrokeRect(context, insetsRect); | ||
CGPoint center = CGPointMake(CGRectGetMidX(insetsRect), CGRectGetMidY(insetsRect)); | ||
CGRect circleRect = CGRectMake(center.x - 10, center.y - 10, 20, 20); | ||
CGContextStrokeEllipseInRect(context, circleRect); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters