Skip to content

Commit

Permalink
fix:AA:Gauge Fix padding
Browse files Browse the repository at this point in the history
  • Loading branch information
tzebrowski committed Sep 27, 2023
1 parent 800ec6d commit 8948d74
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,35 @@ internal class GaugeScreenRenderer (
}

val width = ((area.width()) / widthDivider).toFloat() * widthScaleRatio(metrics)
var left = 0f
val padding = padding(metrics)
var left = padding
firstHalf.forEach {
gaugeRenderer.drawGauge(
canvas, left = area.left + left, top = area.top.toFloat(), width = width,
it
)
left += width
left += width + padding
}
if (size > 1) {
left = 0f
left = padding

secondHalf.forEach {
gaugeRenderer.drawGauge(
canvas, left = area.left + left, top = area.top.toFloat() + height, width = width,
it
)
left += width
left += width + padding
}
}
}

private fun padding(metrics: List<CarMetric>): Float = when (metrics.size) {
2 -> 14f
3 -> 14f
4 -> 14f
else -> 0f
}

private fun widthScaleRatio(metrics: List<CarMetric>): Float = when (metrics.size) {
1 -> 0.8f
2 -> 0.9f
Expand Down

0 comments on commit 8948d74

Please sign in to comment.