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:

committed by
Tomas Klaen

parent
1381d119c6
commit
36dfebca52
@@ -2769,14 +2769,14 @@ function Timeline:render()
|
|||||||
local function draw_chapter(time)
|
local function draw_chapter(time)
|
||||||
local chapter_x = time_x + time_width * (time / state.duration)
|
local chapter_x = time_x + time_width * (time / state.duration)
|
||||||
local ax, bx = chapter_x - chapter_half_width, chapter_x + chapter_half_width
|
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 = {
|
local opts = {
|
||||||
color = options.color_foreground,
|
color = options.color_foreground,
|
||||||
clip = dots and '\\iclip(' .. foreground_coordinates .. ')' or nil,
|
clip = dots and '\\iclip(' .. foreground_coordinates .. ')' or nil,
|
||||||
opacity = options.timeline_chapters_opacity,
|
opacity = options.timeline_chapters_opacity,
|
||||||
}
|
}
|
||||||
|
|
||||||
if dots then
|
if dots then
|
||||||
|
local cx, dx = math.max(ax, fax), math.min(bx, fbx)
|
||||||
-- 0.5 because clipping coordinates are rounded
|
-- 0.5 because clipping coordinates are rounded
|
||||||
if (ax - 0.5) < fax or (bx + 0.5) > fbx then
|
if (ax - 0.5) < fax or (bx + 0.5) > fbx then
|
||||||
ass:circle(chapter_x, chapter_y, chapter_half_height, opts)
|
ass:circle(chapter_x, chapter_y, chapter_half_height, opts)
|
||||||
@@ -2788,6 +2788,7 @@ function Timeline:render()
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
ax, bx = round(ax), round(bx)
|
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
|
local ay, by = chapter_y - chapter_half_height, chapter_y + chapter_half_height
|
||||||
if ax < fax then --left of progress
|
if ax < fax then --left of progress
|
||||||
ass:rect(ax, ay, math.min(bx, fax), by, opts)
|
ass:rect(ax, ay, math.min(bx, fax), by, opts)
|
||||||
|
Reference in New Issue
Block a user