[ios] Match gesture recognizer with map view user interaction state

This commit is contained in:
David Chiles
2017-03-07 14:14:56 -08:00
committed by Jesse Bounds
parent c4fc89977b
commit 10c6f1fe4f
7 changed files with 315 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
## master
* The error passed into `-[MGLMapViewDelegate mapViewDidFailLoadingMap:withError:]` now includes a more specific description and failure reason. ([#8418](https://github.com/mapbox/mapbox-gl-native/pull/8418))
* Fixed an issue where gesture recognizers associated with map view interactivity were not disabled when their related interactions were disabled. ([#8304](https://github.com/mapbox/mapbox-gl-native/pull/8304))
## 3.5.0

View File

@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>
@interface MBXEmbeddedMapViewController : UIViewController
@end

View File

@@ -0,0 +1,89 @@
#import "MBXEmbeddedMapViewController.h"
#import <Mapbox/Mapbox.h>
typedef NS_ENUM(NSInteger, MBXEmbeddedControl) {
MBXEmbeddedControlZoom = 0,
MBXEmbeddedControlScroll,
MBXEmbeddedControlRotation,
MBXEmbeddedControlPitch
};
@interface MBXEmbeddedMapViewController () <UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet MGLMapView *mapView;
@end
@implementation MBXEmbeddedMapViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.scrollView.delegate = self;
self.scrollView.contentSize = self.view.bounds.size;
}
- (IBAction)didSwitch:(UISwitch *)controlSwitch {
[self switchControl:controlSwitch.tag];
}
- (IBAction)rotation:(UIRotationGestureRecognizer *)rotationGesture {
self.mapView.transform = CGAffineTransformRotate(rotationGesture.view.transform, rotationGesture.rotation);
}
- (void)switchControl:(MBXEmbeddedControl) control {
switch (control) {
case MBXEmbeddedControlZoom:
self.mapView.zoomEnabled = !self.mapView.zoomEnabled;
break;
case MBXEmbeddedControlScroll:
self.mapView.scrollEnabled = !self.mapView.scrollEnabled;
break;
case MBXEmbeddedControlRotation:
self.mapView.rotateEnabled = !self.mapView.rotateEnabled;
break;
case MBXEmbeddedControlPitch:
self.mapView.pitchEnabled = !self.mapView.pitchEnabled;
break;
}
}
- (BOOL)statusForControl:(MBXEmbeddedControl) control {
switch (control) {
case MBXEmbeddedControlZoom:
return self.mapView.zoomEnabled;
case MBXEmbeddedControlScroll:
return self.mapView.scrollEnabled;
case MBXEmbeddedControlRotation:
return self.mapView.rotateEnabled;
case MBXEmbeddedControlPitch:
return self.mapView.pitchEnabled;
}
}
#pragma mark UIScrollViewDelegate methods
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return self.mapView;
}
#pragma mark Class method
+ (NSString *)titleForControl:(MBXEmbeddedControl) control {
switch (control) {
case MBXEmbeddedControlZoom:
return @"Zoom Enabled";
case MBXEmbeddedControlScroll:
return @"Scroll Enabled";
break;
case MBXEmbeddedControlRotation:
return @"Rotation Enabled";
break;
case MBXEmbeddedControlPitch:
return @"Pitch Enabled";
break;
}
}
@end

View File

@@ -5,6 +5,7 @@
#import "MBXOfflinePacksTableViewController.h"
#import "MBXAnnotationView.h"
#import "MBXUserLocationAnnotationView.h"
#import "MBXEmbeddedMapViewController.h"
#import <Mapbox/Mapbox.h>
@@ -79,6 +80,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
MBXSettingsMiscellaneousWorldTour,
MBXSettingsMiscellaneousCustomUserDot,
MBXSettingsMiscellaneousShowZoomLevel,
MBXSettingsMiscellaneousScrollView,
MBXSettingsMiscellaneousPrintLogFile,
MBXSettingsMiscellaneousDeleteLogFile,
};
@@ -350,6 +352,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
@"Start World Tour",
[NSString stringWithFormat:@"%@ Custom User Dot", (_customUserLocationAnnnotationEnabled ? @"Disable" : @"Enable")],
[NSString stringWithFormat:@"%@ Zoom Level", (_showZoomLevelEnabled ? @"Hide" :@"Show")],
@"Embedded Map View",
]];
if (self.debugLoggingEnabled)
@@ -615,6 +618,13 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
self.reuseQueueStatsEnabled = NO;
break;
}
case MBXSettingsMiscellaneousScrollView:
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
MBXEmbeddedMapViewController *embeddedMapViewController = (MBXEmbeddedMapViewController *)[storyboard instantiateViewControllerWithIdentifier:@"MBXEmbeddedMapViewController"];
[self.navigationController pushViewController:embeddedMapViewController animated:YES];
break;
}
default:
NSAssert(NO, @"All miscellaneous setting rows should be implemented");
break;

View File

@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="PSe-Ot-7Ff">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="PSe-Ot-7Ff">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="Navigation items with more than one left or right bar item" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -21,6 +25,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kNe-zV-9ha" customClass="MGLMapView">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<connections>
@@ -29,6 +34,7 @@
</connections>
</view>
<label opaque="NO" userInteractionEnabled="NO" alpha="0.69999999999999996" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="58y-pX-YyB">
<rect key="frame" x="179" y="626" width="180" height="21"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="180" id="OL2-l5-I2f"/>
@@ -111,21 +117,21 @@
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Inactive" editingAccessoryType="detailDisclosureButton" textLabel="JtH-Ce-MI5" detailTextLabel="tTJ-jv-U9v" style="IBUITableViewCellStyleSubtitle" id="fGu-Ys-Eh1">
<rect key="frame" x="0.0" y="92" width="375" height="44"/>
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fGu-Ys-Eh1" id="sUf-bc-8xG">
<frame key="frameInset" width="375" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="My Inactive Offline Pack" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="JtH-Ce-MI5">
<frame key="frameInset" minX="15" minY="6" width="174.5" height="19.5"/>
<rect key="frame" x="15" y="6" width="174.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="456 resources (789 MB)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="tTJ-jv-U9v">
<frame key="frameInset" minX="15" minY="25.5" width="128" height="13.5"/>
<rect key="frame" x="15" y="25.5" width="128" height="13.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -135,21 +141,21 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Active" editingAccessoryType="detailDisclosureButton" textLabel="9ZK-gS-wJ4" detailTextLabel="0xK-p8-Mmh" style="IBUITableViewCellStyleSubtitle" id="mKB-tz-Zfl">
<rect key="frame" x="0.0" y="136" width="375" height="44"/>
<rect key="frame" x="0.0" y="72" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="mKB-tz-Zfl" id="nS3-aU-nBr">
<frame key="frameInset" width="375" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="My Active Offline Pack" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="9ZK-gS-wJ4">
<frame key="frameInset" minX="15" minY="6" width="163" height="19.5"/>
<rect key="frame" x="15" y="6" width="163" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Downloading 123 of 456 resources… (789 MB downloaded)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="0xK-p8-Mmh">
<frame key="frameInset" minX="15" minY="25.5" width="310.5" height="13.5"/>
<rect key="frame" x="15" y="25.5" width="310.5" height="13.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -198,6 +204,154 @@
</objects>
<point key="canvasLocation" x="554" y="350"/>
</scene>
<!--Embedded Map View Controller-->
<scene sceneID="dGM-LS-4VE">
<objects>
<viewController storyboardIdentifier="MBXEmbeddedMapViewController" id="Tsi-Cv-L66" customClass="MBXEmbeddedMapViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="xne-oT-1Cv"/>
<viewControllerLayoutGuide type="bottom" id="bxa-Bm-Qun"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="vKr-y9-AZt">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" alwaysBounceHorizontal="YES" minimumZoomScale="0.5" maximumZoomScale="5" translatesAutoresizingMaskIntoConstraints="NO" id="Awd-m3-zh2">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EPE-uN-4XB" customClass="MGLMapView">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<gestureRecognizers/>
<connections>
<outletCollection property="gestureRecognizers" destination="JkF-BS-3oQ" appends="YES" id="yaD-hc-uit"/>
</connections>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="EPE-uN-4XB" secondAttribute="trailing" id="2sl-Ru-a5Y"/>
<constraint firstAttribute="bottom" secondItem="EPE-uN-4XB" secondAttribute="bottom" id="8Rw-xR-dVh"/>
<constraint firstItem="EPE-uN-4XB" firstAttribute="centerX" secondItem="Awd-m3-zh2" secondAttribute="centerX" id="Cj3-w6-vZ5"/>
<constraint firstItem="EPE-uN-4XB" firstAttribute="leading" secondItem="Awd-m3-zh2" secondAttribute="leading" id="atf-fU-XKg"/>
<constraint firstItem="EPE-uN-4XB" firstAttribute="centerY" secondItem="Awd-m3-zh2" secondAttribute="centerY" id="bIx-MH-m69"/>
<constraint firstItem="EPE-uN-4XB" firstAttribute="top" secondItem="Awd-m3-zh2" secondAttribute="top" id="eUo-r5-eDb"/>
</constraints>
</scrollView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="l5l-w7-P80" userLabel="Control Panel View">
<rect key="frame" x="0.0" y="20" width="375" height="64"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Zoom" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DgB-BD-Ltx">
<rect key="frame" x="29.5" y="6" width="35" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="DaP-YL-kD7"/>
</constraints>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="g15-JY-ZNb">
<rect key="frame" x="22.5" y="25" width="51" height="31"/>
<connections>
<action selector="didSwitch:" destination="Tsi-Cv-L66" eventType="valueChanged" id="Obk-GN-o7t"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Scroll" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z7C-yW-Y69" userLabel="Scroll">
<rect key="frame" x="123" y="6" width="35" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="tr6-4a-XN7"/>
</constraints>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tqS-cU-tlc">
<rect key="frame" x="116" y="25" width="51" height="31"/>
<connections>
<action selector="didSwitch:" destination="Tsi-Cv-L66" eventType="valueChanged" id="Dhk-0Y-V4f"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rotation" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vio-XU-tgS">
<rect key="frame" x="209.5" y="6" width="50.5" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="50.5" id="OiV-2P-9xm"/>
</constraints>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" tag="2" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="e57-jT-2xD">
<rect key="frame" x="210" y="25" width="51" height="31"/>
<connections>
<action selector="didSwitch:" destination="Tsi-Cv-L66" eventType="valueChanged" id="DNZ-Uw-kDg"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Pitch" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0uK-zq-Ys2">
<rect key="frame" x="312" y="6" width="31" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="31" id="gM8-I7-4d3"/>
</constraints>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KcQ-OU-a39">
<rect key="frame" x="303.5" y="25" width="51" height="31"/>
<connections>
<action selector="didSwitch:" destination="Tsi-Cv-L66" eventType="valueChanged" id="WhV-yJ-avj"/>
</connections>
</switch>
</subviews>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<gestureRecognizers/>
<constraints>
<constraint firstItem="KcQ-OU-a39" firstAttribute="centerX" secondItem="l5l-w7-P80" secondAttribute="centerX" multiplier="1.75" id="4KT-16-PTD"/>
<constraint firstItem="g15-JY-ZNb" firstAttribute="top" secondItem="DgB-BD-Ltx" secondAttribute="bottom" constant="3" id="85K-VT-rjv"/>
<constraint firstItem="tqS-cU-tlc" firstAttribute="centerX" secondItem="l5l-w7-P80" secondAttribute="centerX" multiplier="0.75" id="8jz-5L-klT"/>
<constraint firstItem="z7C-yW-Y69" firstAttribute="centerX" secondItem="tqS-cU-tlc" secondAttribute="centerX" id="DXz-6O-RE3"/>
<constraint firstItem="0uK-zq-Ys2" firstAttribute="centerX" secondItem="KcQ-OU-a39" secondAttribute="centerX" id="Mde-fT-Bcq"/>
<constraint firstItem="z7C-yW-Y69" firstAttribute="bottom" secondItem="DgB-BD-Ltx" secondAttribute="bottom" id="PnN-Hv-drW"/>
<constraint firstItem="z7C-yW-Y69" firstAttribute="top" secondItem="DgB-BD-Ltx" secondAttribute="top" id="Q2C-Qw-gvB"/>
<constraint firstAttribute="bottom" secondItem="e57-jT-2xD" secondAttribute="bottom" constant="8" id="WWq-zC-XdG"/>
<constraint firstItem="0uK-zq-Ys2" firstAttribute="bottom" secondItem="DgB-BD-Ltx" secondAttribute="bottom" id="aBL-og-FYW"/>
<constraint firstItem="Vio-XU-tgS" firstAttribute="bottom" secondItem="DgB-BD-Ltx" secondAttribute="bottom" id="aMh-TW-sMO"/>
<constraint firstAttribute="height" constant="64" id="aSG-KD-M7a"/>
<constraint firstAttribute="bottom" secondItem="KcQ-OU-a39" secondAttribute="bottom" constant="8" id="cdo-Mc-M8y"/>
<constraint firstItem="e57-jT-2xD" firstAttribute="centerX" secondItem="l5l-w7-P80" secondAttribute="centerX" multiplier="1.25" id="e4H-V7-rMk"/>
<constraint firstAttribute="bottom" secondItem="tqS-cU-tlc" secondAttribute="bottom" constant="8" id="e6X-7b-GNt"/>
<constraint firstItem="Vio-XU-tgS" firstAttribute="top" secondItem="DgB-BD-Ltx" secondAttribute="top" id="g0I-sb-f7w"/>
<constraint firstItem="Vio-XU-tgS" firstAttribute="centerX" secondItem="e57-jT-2xD" secondAttribute="centerX" id="gXC-pq-4Aa"/>
<constraint firstAttribute="bottom" secondItem="g15-JY-ZNb" secondAttribute="bottom" constant="8" id="kBT-94-cqr"/>
<constraint firstItem="DgB-BD-Ltx" firstAttribute="centerX" secondItem="g15-JY-ZNb" secondAttribute="centerX" id="wjr-6Z-EUS"/>
<constraint firstItem="g15-JY-ZNb" firstAttribute="centerX" secondItem="l5l-w7-P80" secondAttribute="centerX" multiplier="0.25" id="xsC-iQ-ytS"/>
<constraint firstItem="0uK-zq-Ys2" firstAttribute="top" secondItem="DgB-BD-Ltx" secondAttribute="top" id="zK5-CA-VoR"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="l5l-w7-P80" secondAttribute="trailing" id="3lX-X1-azn"/>
<constraint firstItem="Awd-m3-zh2" firstAttribute="leading" secondItem="vKr-y9-AZt" secondAttribute="leading" id="9yi-vl-QxH"/>
<constraint firstItem="l5l-w7-P80" firstAttribute="top" secondItem="xne-oT-1Cv" secondAttribute="bottom" id="AN8-3I-WUs"/>
<constraint firstAttribute="trailing" secondItem="Awd-m3-zh2" secondAttribute="trailing" id="IfY-Eb-UaJ"/>
<constraint firstItem="Awd-m3-zh2" firstAttribute="top" secondItem="vKr-y9-AZt" secondAttribute="top" id="ZCQ-9O-kJP"/>
<constraint firstItem="l5l-w7-P80" firstAttribute="leading" secondItem="vKr-y9-AZt" secondAttribute="leading" id="gGq-lE-d7X"/>
<constraint firstItem="Awd-m3-zh2" firstAttribute="bottom" secondItem="bxa-Bm-Qun" secondAttribute="top" id="tV3-fH-i8W"/>
</constraints>
</view>
<connections>
<outlet property="mapView" destination="EPE-uN-4XB" id="EDJ-xp-uBi"/>
<outlet property="scrollView" destination="Awd-m3-zh2" id="TJn-gU-Hgs"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="k2c-Gr-mpl" userLabel="First Responder" sceneMemberID="firstResponder"/>
<rotationGestureRecognizer id="JkF-BS-3oQ">
<connections>
<action selector="rotation:" destination="Tsi-Cv-L66" id="Zba-E5-Dmz"/>
</connections>
</rotationGestureRecognizer>
</objects>
<point key="canvasLocation" x="594.39999999999998" y="1083.5082458770617"/>
</scene>
</scenes>
<resources>
<image name="TrackingLocationOffMask.png" width="23" height="23"/>

View File

@@ -176,6 +176,7 @@
558DE7A21E5615E400C7916D /* MGLFoundation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 558DE79F1E5615E400C7916D /* MGLFoundation.mm */; };
558DE7A31E5615E400C7916D /* MGLFoundation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 558DE79F1E5615E400C7916D /* MGLFoundation.mm */; };
55E2AD131E5B125400E8C587 /* MGLOfflineStorageTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 55E2AD121E5B125400E8C587 /* MGLOfflineStorageTests.mm */; };
632281DF1E6F855900D75A5D /* MBXEmbeddedMapViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 632281DE1E6F855900D75A5D /* MBXEmbeddedMapViewController.m */; };
6407D6701E0085FD00F6A9C3 /* MGLDocumentationExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6407D66F1E0085FD00F6A9C3 /* MGLDocumentationExampleTests.swift */; };
7E016D7E1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */; };
7E016D7F1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */; };
@@ -639,6 +640,8 @@
55D8C9941D0F133500F42F10 /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = config.xcconfig; path = ../../build/ios/config.xcconfig; sourceTree = "<group>"; };
55D8C9951D0F18CE00F42F10 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
55E2AD121E5B125400E8C587 /* MGLOfflineStorageTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLOfflineStorageTests.mm; path = ../../darwin/test/MGLOfflineStorageTests.mm; sourceTree = "<group>"; };
632281DD1E6F855900D75A5D /* MBXEmbeddedMapViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBXEmbeddedMapViewController.h; sourceTree = "<group>"; };
632281DE1E6F855900D75A5D /* MBXEmbeddedMapViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXEmbeddedMapViewController.m; sourceTree = "<group>"; };
6407D66F1E0085FD00F6A9C3 /* MGLDocumentationExampleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MGLDocumentationExampleTests.swift; path = ../../darwin/test/MGLDocumentationExampleTests.swift; sourceTree = "<group>"; };
7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLPolyline+MGLAdditions.h"; sourceTree = "<group>"; };
7E016D7D1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MGLPolyline+MGLAdditions.m"; sourceTree = "<group>"; };
@@ -1123,6 +1126,8 @@
DA1DC9691CB6C6B7006E619F /* MBXOfflinePacksTableViewController.m */,
DA1DC9531CB6C1C2006E619F /* MBXViewController.h */,
DA1DC99A1CB6E064006E619F /* MBXViewController.m */,
632281DD1E6F855900D75A5D /* MBXEmbeddedMapViewController.h */,
632281DE1E6F855900D75A5D /* MBXEmbeddedMapViewController.m */,
DA821D051CCC6D59007508D4 /* Main.storyboard */,
DA821D041CCC6D59007508D4 /* LaunchScreen.storyboard */,
DA1DC99E1CB6E088006E619F /* Assets.xcassets */,
@@ -2071,6 +2076,7 @@
DA1DC96A1CB6C6B7006E619F /* MBXCustomCalloutView.m in Sources */,
DA1DC99B1CB6E064006E619F /* MBXViewController.m in Sources */,
40FDA76B1CCAAA6800442548 /* MBXAnnotationView.m in Sources */,
632281DF1E6F855900D75A5D /* MBXEmbeddedMapViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -240,6 +240,8 @@ public:
@property (nonatomic) UIActionSheet *attributionSheet;
@property (nonatomic, readwrite) MGLStyle *style;
@property (nonatomic) UITapGestureRecognizer *singleTapGestureRecognizer;
@property (nonatomic) UITapGestureRecognizer *doubleTap;
@property (nonatomic) UITapGestureRecognizer *twoFingerTap;
@property (nonatomic) UIPanGestureRecognizer *pan;
@property (nonatomic) UIPinchGestureRecognizer *pinch;
@property (nonatomic) UIRotationGestureRecognizer *rotate;
@@ -515,26 +517,26 @@ public:
[self addGestureRecognizer:_rotate];
_rotateEnabled = YES;
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapGesture:)];
doubleTap.numberOfTapsRequired = 2;
[self addGestureRecognizer:doubleTap];
_doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapGesture:)];
_doubleTap.numberOfTapsRequired = 2;
[self addGestureRecognizer:_doubleTap];
_singleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTapGesture:)];
[_singleTapGestureRecognizer requireGestureRecognizerToFail:doubleTap];
[_singleTapGestureRecognizer requireGestureRecognizerToFail:_doubleTap];
_singleTapGestureRecognizer.delegate = self;
[self addGestureRecognizer:_singleTapGestureRecognizer];
UITapGestureRecognizer *twoFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerTapGesture:)];
twoFingerTap.numberOfTouchesRequired = 2;
[twoFingerTap requireGestureRecognizerToFail:_pinch];
[twoFingerTap requireGestureRecognizerToFail:_rotate];
[self addGestureRecognizer:twoFingerTap];
_twoFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerTapGesture:)];
_twoFingerTap.numberOfTouchesRequired = 2;
[_twoFingerTap requireGestureRecognizerToFail:_pinch];
[_twoFingerTap requireGestureRecognizerToFail:_rotate];
[self addGestureRecognizer:_twoFingerTap];
_twoFingerDrag = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerDragGesture:)];
_twoFingerDrag.minimumNumberOfTouches = 2;
_twoFingerDrag.maximumNumberOfTouches = 2;
_twoFingerDrag.delegate = self;
[_twoFingerDrag requireGestureRecognizerToFail:twoFingerTap];
[_twoFingerDrag requireGestureRecognizerToFail:_twoFingerTap];
[_twoFingerDrag requireGestureRecognizerToFail:_pan];
[self addGestureRecognizer:_twoFingerDrag];
_pitchEnabled = YES;
@@ -544,7 +546,7 @@ public:
_quickZoom = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleQuickZoomGesture:)];
_quickZoom.numberOfTapsRequired = 1;
_quickZoom.minimumPressDuration = 0;
[_quickZoom requireGestureRecognizerToFail:doubleTap];
[_quickZoom requireGestureRecognizerToFail:_doubleTap];
[self addGestureRecognizer:_quickZoom];
// observe app activity
@@ -2128,6 +2130,33 @@ public:
_mbglMap->onLowMemory();
}
- (void)setZoomEnabled:(BOOL)zoomEnabled
{
_zoomEnabled = zoomEnabled;
self.pinch.enabled = zoomEnabled;
self.doubleTap.enabled = zoomEnabled;
self.quickZoom.enabled = zoomEnabled;
self.twoFingerTap.enabled = zoomEnabled;
}
- (void)setScrollEnabled:(BOOL)scrollEnabled
{
_scrollEnabled = scrollEnabled;
self.pan.enabled = scrollEnabled;
}
- (void)setRotateEnabled:(BOOL)rotateEnabled
{
_rotateEnabled = rotateEnabled;
self.rotate.enabled = rotateEnabled;
}
- (void)setPitchEnabled:(BOOL)pitchEnabled
{
_pitchEnabled = pitchEnabled;
self.twoFingerDrag.enabled = pitchEnabled;
}
#pragma mark - Accessibility -
- (NSString *)accessibilityValue