Skip to content

Commit

Permalink
allows tapping on edges of demo to adjust north, when option is turne…
Browse files Browse the repository at this point in the history
…d on
  • Loading branch information
Andrew Hart authored and Andrew Hart committed Jul 26, 2017
1 parent 1737fc4 commit e93be3f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions ARKit+CoreLocation/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class ViewController: UIViewController, MKMapViewDelegate, SceneLocationViewDele

var updateInfoLabelTimer: Timer?

var adjustNorthByTappingSidesOfScreen = false

override func viewDidLoad() {
super.viewDidLoad()

Expand Down Expand Up @@ -220,10 +222,21 @@ class ViewController: UIViewController, MKMapViewDelegate, SceneLocationViewDele
mapView.recursiveSubviews().contains(touch.view!)) {
centerMapOnUserLocation = false
} else {
let image = UIImage(named: "pin")!
let annotationNode = LocationAnnotationNode(location: nil, image: image)

sceneLocationView.addLocationNodeForCurrentPosition(locationNode: annotationNode)
let location = touch.location(in: self.view)

if location.x <= 40 && adjustNorthByTappingSidesOfScreen {
print("left side of the screen")
sceneLocationView.moveSceneHeadingAntiClockwise()
} else if location.x >= view.frame.size.width - 40 && adjustNorthByTappingSidesOfScreen {
print("right side of the screen")
sceneLocationView.moveSceneHeadingClockwise()
} else {
let image = UIImage(named: "pin")!
let annotationNode = LocationAnnotationNode(location: nil, image: image)
annotationNode.scaleRelativeToDistance = true
sceneLocationView.addLocationNodeForCurrentPosition(locationNode: annotationNode)
}
}
}
}
Expand Down

0 comments on commit e93be3f

Please sign in to comment.