Sanitize cached ranges before render

ref #34
This commit is contained in:
Tomas Sardyha
2020-07-14 09:44:47 +02:00
parent 2101edd86d
commit 1528d75b19

View File

@@ -1424,9 +1424,11 @@ function render_timeline(this)
ass:append(ass_opacity(options.timeline_cached_ranges.opacity)) ass:append(ass_opacity(options.timeline_cached_ranges.opacity))
ass:pos(0, 0) ass:pos(0, 0)
ass:draw_start() ass:draw_start()
local range_start = math.max(type(range['start']) == 'number' and range['start'] or 0.000001, 0.000001)
local range_end = math.min(type(range['end']) and range['end'] or state.duration, state.duration)
ass:rect_cw( ass:rect_cw(
bbx * (range['start'] / state.duration), range_ay, bbx * (range_start / state.duration), range_ay,
bbx * (range['end'] / state.duration), range_ay + range_height bbx * (range_end / state.duration), range_ay + range_height
) )
ass:draw_stop() ass:draw_stop()
end end