diff options
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt index 4298058..a8eb2fa 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt @@ -78,10 +78,9 @@ class MapFragment : GlobeMapFragment() { val loader = QuadImageLoader(params, tileInfo, baseControl) loader.setImageFormat(RenderController.ImageFormat.MaplyImageUShort565) - val latitude = 23.191 * Math.PI / 180 - val longitude = -100.36 * Math.PI / 180 - val zoom = 0.4 - mapControl.setPositionGeo(longitude, latitude, zoom) + val latitude = 23.191 + val longitude = -100.36 + focusOn(latitude, longitude, zoom = 0.4, animated = false) } override fun userDidSelect( @@ -140,11 +139,14 @@ class MapFragment : GlobeMapFragment() { ) } - fun focusOn(latitude: Double, longitude: Double) { + fun focusOn(latitude: Double, longitude: Double, zoom: Double = 0.000008, animated: Boolean = true) { val lat = latitude * Math.PI / 180 val lon = longitude * Math.PI / 180 - val zoom = 0.000008 - mapControl.setPositionGeo(lon, lat, zoom) + if (animated) { + mapControl.animatePositionGeo(lon, lat, zoom, 0.5) + } else { + mapControl.setPositionGeo(lon, lat, zoom) + } } private fun getIcon(markerType: MarkerType): Bitmap { |