Skip to content

Commit

Permalink
Fix a few bugs
Browse files Browse the repository at this point in the history
Weird
  • Loading branch information
captainbarbosa committed Aug 15, 2019
1 parent 1341b3f commit 0241c01
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ class MapViewController: UIViewController {
mapView.setCenter(CLLocationCoordinate2D(latitude: -42, longitude: -187.5), zoomLevel: 4, animated: false)
mapView.delegate = self
view.addSubview(mapView)

let singleTap = UITapGestureRecognizer(target: self, action: #selector(handleMapTap(sender:)))
mapView.addGestureRecognizer(singleTap)
}

@objc func handleMapTap(sender: UITapGestureRecognizer) {
let coordinate = mapView.convert(sender.location(in: mapView), toCoordinateFrom: mapView)
print(coordinate)
}

func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
Expand Down Expand Up @@ -146,12 +138,6 @@ extension MapViewController: MGLAnnotationControllerDelegate {
settingsViewController.modalPresentationStyle = .custom
self.present(settingsViewController, animated: true, completion: nil)
}

func annotationController(_ annotationController: MGLAnnotationController, didDeselect styleAnnotation: MGLStyleAnnotation) {
// This isn't an optional method so we have to do something here.
// Ref: https://github.com/mapbox/map-extensions-ios/issues/44
print("Deselected style annotation")
}
}

extension MapViewController: AnnotationStyleSettingsDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class SettingsViewController: UIViewController {
let scollView = UIScrollView()
scollView.translatesAutoresizingMaskIntoConstraints = false
scollView.isScrollEnabled = true
scollView.bounces = false
scollView.indicatorStyle = .white
containerView.addSubview(scollView)

Expand Down Expand Up @@ -104,15 +105,15 @@ class SettingsViewController: UIViewController {
scrollView.heightAnchor.constraint(equalTo: containerView.heightAnchor),
scrollView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
scrollView.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 15.0),
scrollView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor)
scrollView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
])

// Setting components vertical stack view
NSLayoutConstraint.activate([
settingsView.centerXAnchor.constraint(equalTo: scrollView.centerXAnchor),
settingsView.widthAnchor.constraint(equalTo: scrollView.widthAnchor, multiplier: 0.9),
settingsView.topAnchor.constraint(equalTo: scrollView.topAnchor),
settingsView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor)
settingsView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: -60.0),
])
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class SymbolSettingsView: StyleAnnotationSettingsView {
self.symbol.iconImageName = self.iconSettings[index].imageName
}
},
observe( \.fontColorSetting?.currentValue, options: [.old, .new] ) { object, change in
observe( \.iconColorSetting?.currentValue, options: [.old, .new] ) { object, change in
if let newIconColor = change.newValue as? UIColor {
self.symbol.iconColor = newIconColor
}
Expand Down

0 comments on commit 0241c01

Please sign in to comment.