Skip to content

Commit 47c3bf0

Browse files
authored
fix(MarkableTimeBar): align segments to timebar (libre-tube#7055)
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.
2 parents 2ae689c + ea6483d commit 47c3bf0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/main/java/com/github/libretube/ui/views/MarkableTimeBar.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class MarkableTimeBar(
3838
canvas.save()
3939
val horizontalOffset = (parent as View).marginLeft
4040
length = canvas.width - horizontalOffset * 2
41-
val marginY = canvas.height / 2 - progressBarHeight / 2
41+
val marginY = (canvas.height - progressBarHeight) / 2
4242
val themeColor = ThemeHelper.getThemeColor(context, R.attr.colorOnSecondary)
4343

4444
segments.forEach {
@@ -49,7 +49,7 @@ class MarkableTimeBar(
4949
start.toLength() + horizontalOffset,
5050
marginY,
5151
end.toLength() + horizontalOffset,
52-
canvas.height - marginY
52+
marginY + progressBarHeight
5353
),
5454
Paint().apply {
5555
color = if (PreferenceHelper.getBoolean("sb_enable_custom_colors", false)) {

0 commit comments

Comments
 (0)