mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: scale requiredZoomLevel() by 0.8 to improve fit
This commit is contained in:
parent
45d3741124
commit
d4137a7dc4
3 changed files with 10 additions and 16 deletions
|
|
@ -507,7 +507,7 @@ fun MapView(
|
|||
val geoPoints = model.nodesWithPosition.map { GeoPoint(it.latitude, it.longitude) }
|
||||
val box = BoundingBox.fromGeoPoints(geoPoints)
|
||||
val center = GeoPoint(box.centerLatitude, box.centerLongitude)
|
||||
val finalZoomLevel = minOf(box.requiredZoomLevel() * 0.8, maxZoomLevel)
|
||||
val finalZoomLevel = minOf(box.requiredZoomLevel(), maxZoomLevel)
|
||||
controller.setCenter(center)
|
||||
controller.setZoom(finalZoomLevel)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ fun BoundingBox.requiredZoomLevel(): Double {
|
|||
val latLonHeight = topLeft.distanceToAsDouble(GeoPoint(bottomRight.latitude, topLeft.longitude))
|
||||
val requiredLatZoom = log2(360.0 / (latLonHeight / 111320))
|
||||
val requiredLonZoom = log2(360.0 / (latLonWidth / 111320))
|
||||
return maxOf(requiredLatZoom, requiredLonZoom)
|
||||
return maxOf(requiredLatZoom, requiredLonZoom) * 0.8
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue