mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
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:
parent
2ae689c74d
commit
ea6483df74
@ -38,7 +38,7 @@ class MarkableTimeBar(
|
|||||||
canvas.save()
|
canvas.save()
|
||||||
val horizontalOffset = (parent as View).marginLeft
|
val horizontalOffset = (parent as View).marginLeft
|
||||||
length = canvas.width - horizontalOffset * 2
|
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)
|
val themeColor = ThemeHelper.getThemeColor(context, R.attr.colorOnSecondary)
|
||||||
|
|
||||||
segments.forEach {
|
segments.forEach {
|
||||||
@ -49,7 +49,7 @@ class MarkableTimeBar(
|
|||||||
start.toLength() + horizontalOffset,
|
start.toLength() + horizontalOffset,
|
||||||
marginY,
|
marginY,
|
||||||
end.toLength() + horizontalOffset,
|
end.toLength() + horizontalOffset,
|
||||||
canvas.height - marginY
|
marginY + progressBarHeight
|
||||||
),
|
),
|
||||||
Paint().apply {
|
Paint().apply {
|
||||||
color = if (PreferenceHelper.getBoolean("sb_enable_custom_colors", false)) {
|
color = if (PreferenceHelper.getBoolean("sb_enable_custom_colors", false)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user