fix(MarkableTimeBar): align segments to timebar

Due to a error in the timebar position calculation, segments could
be msialigned by a pixel. This is fixed by using a caculation that more
closely matches how the actual timebar is drawn.
This commit is contained in:
FineFindus 2025-01-30 16:09:23 +01:00
parent 2ae689c74d
commit ea6483df74
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B

View File

@ -38,7 +38,7 @@ class MarkableTimeBar(
canvas.save()
val horizontalOffset = (parent as View).marginLeft
length = canvas.width - horizontalOffset * 2
val marginY = canvas.height / 2 - progressBarHeight / 2
val marginY = (canvas.height - progressBarHeight) / 2
val themeColor = ThemeHelper.getThemeColor(context, R.attr.colorOnSecondary)
segments.forEach {
@ -49,7 +49,7 @@ class MarkableTimeBar(
start.toLength() + horizontalOffset,
marginY,
end.toLength() + horizontalOffset,
canvas.height - marginY
marginY + progressBarHeight
),
Paint().apply {
color = if (PreferenceHelper.getBoolean("sb_enable_custom_colors", false)) {