kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
fix(map): `generateBoxOverlay` event listener
rodzic
ed1ce77608
commit
625bc6837b
|
@ -549,6 +549,17 @@ fun MapView(
|
||||||
cacheEstimate = context.getString(R.string.map_cache_tiles, tileCount)
|
cacheEstimate = context.getString(R.string.map_cache_tiles, tileCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val boxOverlayListener = object : MapListener {
|
||||||
|
override fun onScroll(event: ScrollEvent): Boolean {
|
||||||
|
map.generateBoxOverlay()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onZoom(event: ZoomEvent): Boolean {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun startDownload() {
|
fun startDownload() {
|
||||||
val boundingBox = downloadRegionBoundingBox ?: return
|
val boundingBox = downloadRegionBoundingBox ?: return
|
||||||
try {
|
try {
|
||||||
|
@ -614,6 +625,7 @@ fun MapView(
|
||||||
0 -> showCurrentCacheInfo = true
|
0 -> showCurrentCacheInfo = true
|
||||||
1 -> {
|
1 -> {
|
||||||
map.generateBoxOverlay()
|
map.generateBoxOverlay()
|
||||||
|
map.addMapListener(boxOverlayListener)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +668,7 @@ fun MapView(
|
||||||
// Disables default +/- button for zooming
|
// Disables default +/- button for zooming
|
||||||
zoomController.setVisibility(CustomZoomButtonsController.Visibility.NEVER)
|
zoomController.setVisibility(CustomZoomButtonsController.Visibility.NEVER)
|
||||||
addMapEventListener {
|
addMapEventListener {
|
||||||
model.updateMapCenterAndZoom(map.projection.currentCenter, map.zoomLevelDouble)
|
model.updateMapCenterAndZoom(projection.currentCenter, zoomLevelDouble)
|
||||||
}
|
}
|
||||||
zoomToNodes()
|
zoomToNodes()
|
||||||
}
|
}
|
||||||
|
@ -668,6 +680,7 @@ fun MapView(
|
||||||
cacheEstimate = cacheEstimate,
|
cacheEstimate = cacheEstimate,
|
||||||
onExecuteJob = { startDownload() },
|
onExecuteJob = { startDownload() },
|
||||||
onCancelDownload = {
|
onCancelDownload = {
|
||||||
|
map.removeMapListener(boxOverlayListener)
|
||||||
downloadRegionBoundingBox = null
|
downloadRegionBoundingBox = null
|
||||||
map.overlays.removeAll { it is Polygon }
|
map.overlays.removeAll { it is Polygon }
|
||||||
map.invalidate()
|
map.invalidate()
|
||||||
|
|
Ładowanie…
Reference in New Issue