cleaned up code

This commit is contained in:
Jackson Rosenthal 2022-02-05 22:03:51 -05:00
parent 062cad189e
commit b5a09d502a

View file

@ -91,7 +91,6 @@ class MapFragment : ScreenFragment("Map"), Logging {
nodePositions.featureCollection(getCurrentNodes())
}
//TODO Update camera movements
private fun zoomToNodes(map: MapboxMap) {
val points: MutableList<Point> = mutableListOf()
val nodesWithPosition =
@ -100,10 +99,13 @@ class MapFragment : ScreenFragment("Map"), Logging {
val unit = if (nodesWithPosition.size >= 2) {
// Multiple nodes, make them all fit on the map view
for (node in nodesWithPosition) {
val point =
Point.fromLngLat(node.position!!.longitude, node.position!!.latitude)
points.add(point)
nodesWithPosition.forEach {
points.add(
Point.fromLngLat(
it.position!!.longitude,
it.position!!.latitude
)
)
}
map.cameraForCoordinates(points)
} else {
@ -115,7 +117,6 @@ class MapFragment : ScreenFragment("Map"), Logging {
this.zoom(9.0)
this.center(points[0])
}
}
map.flyTo(
unit,