diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-04 23:15:54 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-04 23:15:54 -0600 |
commit | 08863d4c9336d7d8a795124fefcf0efa9c23cb30 (patch) | |
tree | 3ce3876a07541e9dca460f0094a824faa89c638d /androidApp/src/main/java/mx | |
parent | 956ae12a22a5d4895ec7bbca5c35a98a66acbe61 (diff) | |
download | etbsa-trackermap-mobile-08863d4c9336d7d8a795124fefcf0efa9c23cb30.tar.gz etbsa-trackermap-mobile-08863d4c9336d7d8a795124fefcf0efa9c23cb30.tar.bz2 etbsa-trackermap-mobile-08863d4c9336d7d8a795124fefcf0efa9c23cb30.zip |
Animated marker centering and small UI tweak
Diffstat (limited to 'androidApp/src/main/java/mx')
-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 { |