/tripkit/TripKitAndroidUI/com.skedgo.tripkit.ui.tripresult/expandedForHorizontalLabels

expandedForHorizontalLabels

\ fun LatLngBounds.expandedForHorizontalLabels(labelExtentPx: Int, mapWidthPx: Int, mapHeightPx: Int, paddingPx: Int): LatLngBounds

Returns bounds widened east and west so that, when fitted into a mapWidthPx x mapHeightPx map with paddingPx on every side, there are at least labelExtentPx pixels between the leftmost/rightmost point and the map edge. Marker labels such as the trip time pills are drawn beside their marker, so a uniform padding clips them at the screen edge once the label is wider than the padding (e.g. at large font scales).

Uses Web Mercator, so the result is exact for the zoom Google Maps picks for these bounds. The label room is capped at ⅜ of the map width so the route keeps at least a quarter. Bounds crossing the antimeridian, a single point, or missing map dimensions are returned unchanged.