fix: chapter line intersection not using rounded values

Lines used rounded coordinates for clean lines outside of the progress
indicator, but still used the non rounded ones when overlapping.
This commit is contained in:
Christoph Heinrich
2022-09-09 23:44:25 +02:00
committed by Tomas Klaen
parent 1381d119c6
commit 36dfebca52

View File

@@ -2769,7 +2769,6 @@ function Timeline:render()
local function draw_chapter(time)
local chapter_x = time_x + time_width * (time / state.duration)
local ax, bx = chapter_x - chapter_half_width, chapter_x + chapter_half_width
local cx, dx = math.max(ax, fax), math.min(bx, fbx)
local opts = {
color = options.color_foreground,
clip = dots and '\\iclip(' .. foreground_coordinates .. ')' or nil,
@@ -2777,6 +2776,7 @@ function Timeline:render()
}
if dots then
local cx, dx = math.max(ax, fax), math.min(bx, fbx)
-- 0.5 because clipping coordinates are rounded
if (ax - 0.5) < fax or (bx + 0.5) > fbx then
ass:circle(chapter_x, chapter_y, chapter_half_height, opts)
@@ -2788,6 +2788,7 @@ function Timeline:render()
end
else
ax, bx = round(ax), round(bx)
local cx, dx = math.max(ax, fax), math.min(bx, fbx)
local ay, by = chapter_y - chapter_half_height, chapter_y + chapter_half_height
if ax < fax then --left of progress
ass:rect(ax, ay, math.min(bx, fax), by, opts)