Skip to content

Commit

Permalink
clear map
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobby Sudekum committed Jun 13, 2017
1 parent 604b9bf commit 7517bed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Examples/Swift/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
<action selector="didTapGetRoute:" destination="BYZ-38-t0r" eventType="touchUpInside" id="ffn-fF-Lba"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="p1Q-wj-seE">
<rect key="frame" x="8" y="585" width="70" height="30"/>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="p1Q-wj-seE">
<rect key="frame" x="8" y="565" width="70" height="30"/>
<state key="normal" title="Clear map"/>
<connections>
<action selector="didTapClearmap:" destination="BYZ-38-t0r" eventType="touchUpInside" id="YbJ-3h-xu2"/>
Expand All @@ -82,7 +82,7 @@
<constraint firstAttribute="bottom" secondItem="8Sl-bV-xyU" secondAttribute="bottom" id="LOb-l9-Iql"/>
<constraint firstItem="8Sl-bV-xyU" firstAttribute="width" secondItem="A3N-JT-loC" secondAttribute="width" multiplier="1:2" id="Pds-uP-zSB"/>
<constraint firstAttribute="trailing" secondItem="KIU-cH-IXd" secondAttribute="trailing" id="Q7E-HM-WIz"/>
<constraint firstItem="oWT-TG-jZs" firstAttribute="top" secondItem="p1Q-wj-seE" secondAttribute="bottom" constant="8" id="SbN-yI-sn0"/>
<constraint firstItem="oWT-TG-jZs" firstAttribute="top" secondItem="p1Q-wj-seE" secondAttribute="bottom" constant="28" id="SbN-yI-sn0"/>
<constraint firstAttribute="trailing" secondItem="oWT-TG-jZs" secondAttribute="trailing" id="TC4-VU-ggG"/>
<constraint firstAttribute="bottom" secondItem="KIU-cH-IXd" secondAttribute="bottom" id="TjN-pb-n3K"/>
<constraint firstItem="p1Q-wj-seE" firstAttribute="leading" secondItem="A3N-JT-loC" secondAttribute="leading" constant="8" id="djs-kC-Hft"/>
Expand Down Expand Up @@ -121,6 +121,7 @@
</constraints>
</view>
<connections>
<outlet property="clearMapButton" destination="p1Q-wj-seE" id="ULz-0n-Sys"/>
<outlet property="getRouteButton" destination="oWT-TG-jZs" id="b4W-Xb-oB7"/>
<outlet property="howToBeginLabel" destination="Hk0-SM-2Wl" id="iU7-G1-DBc"/>
<outlet property="mapView" destination="A3N-JT-loC" id="iZS-hq-X5f"/>
Expand Down
8 changes: 6 additions & 2 deletions Examples/Swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ViewController: UIViewController, MGLMapViewDelegate, NavigationViewContro
@IBOutlet weak var simulateNavigationButton: UIButton!
@IBOutlet weak var howToBeginLabel: UILabel!
@IBOutlet weak var getRouteButton: UIButton!
@IBOutlet weak var clearMapButton: UIButton!

override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -43,8 +44,9 @@ class ViewController: UIViewController, MGLMapViewDelegate, NavigationViewContro

let coordinates = mapView.convert(sender.location(in: mapView), toCoordinateFrom: mapView)

getRouteButton.isHidden = false
howToBeginLabel.isHidden = true
getRouteButton.isHidden = false
clearMapButton.isHidden = false

let annotation = MGLPointAnnotation()
annotation.coordinate = coordinates
Expand All @@ -64,10 +66,12 @@ class ViewController: UIViewController, MGLMapViewDelegate, NavigationViewContro

startNavigationButton.isHidden = true
simulateNavigationButton.isHidden = true
howToBeginLabel.isHidden = false
getRouteButton.isHidden = true
clearMapButton.isHidden = true
howToBeginLabel.isHidden = false

waypoints.removeAll()
mapView.removeRoute()
}

@IBAction func didTapGetRoute(_ sender: Any) {
Expand Down
2 changes: 1 addition & 1 deletion MapboxCoreNavigation/RouteController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ extension RouteController: CLLocationManagerDelegate {
let secondsToEndOfStep = userSnapToStepDistanceFromManeuver / location.speed

guard routeProgress.currentLegProgress.alertUserLevel != .arrive,
routeProgress.remainingWaypoints.count > 1 else {
routeProgress.remainingWaypoints.count > 0 else {
// Don't advance nor check progress if the user has arrived at their destination
suspendLocationUpdates()
NotificationCenter.default.post(name: RouteControllerProgressDidChange, object: self, userInfo: [
Expand Down

0 comments on commit 7517bed

Please sign in to comment.