mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
Merge pull request #3846 from Bnyro/master
Fix the position of the SponsorBlock markers
This commit is contained in:
commit
1e598740ab
@ -38,23 +38,20 @@ class MarkableTimeBar(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun drawSegments(canvas: Canvas) {
|
private fun drawSegments(canvas: Canvas) {
|
||||||
if (player == null) return
|
val markersEnabled = PreferenceHelper.getBoolean(PreferenceKeys.SB_SHOW_MARKERS, true)
|
||||||
|
if (player == null || !markersEnabled) return
|
||||||
if (!PreferenceHelper.getBoolean(PreferenceKeys.SB_SHOW_MARKERS, true)) return
|
|
||||||
|
|
||||||
val horizontalOffset = (parent as View).marginLeft
|
|
||||||
|
|
||||||
canvas.save()
|
canvas.save()
|
||||||
length = canvas.width - 2 * horizontalOffset
|
val horizontalOffset = (parent as View).marginLeft
|
||||||
|
length = canvas.width - horizontalOffset * 2
|
||||||
val marginY = canvas.height / 2 - progressBarHeight / 2
|
val marginY = canvas.height / 2 - progressBarHeight / 2
|
||||||
|
|
||||||
segments.forEach {
|
segments.forEach {
|
||||||
canvas.drawRect(
|
canvas.drawRect(
|
||||||
Rect(
|
Rect(
|
||||||
(it.segment.first() + horizontalOffset).toLength(),
|
it.segment.first().toLength() + horizontalOffset,
|
||||||
marginY,
|
marginY,
|
||||||
(it.segment.last() + horizontalOffset).toLength(),
|
it.segment.last().toLength() + horizontalOffset,
|
||||||
canvas.height - marginY,
|
canvas.height - marginY,
|
||||||
),
|
),
|
||||||
Paint().apply {
|
Paint().apply {
|
||||||
|
Loading…
Reference in New Issue
Block a user