From b01c6df787c4ac0f3e5603286c30741cf39467e9 Mon Sep 17 00:00:00 2001 From: christoph-heinrich Date: Mon, 20 May 2024 23:06:25 +0200 Subject: [PATCH] fix: buffered_time_threshold check (#907) a7136337c852a51bf4a55da3fd69257171a40415 fixed the shown duration, but the threshold check wasn't adjusted and therefore still didn't behave the same as before 00737e1598da8756ac70f8199b022dc7cc09d43e. --- src/uosc/elements/Timeline.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uosc/elements/Timeline.lua b/src/uosc/elements/Timeline.lua index 57671567..8bc825db 100644 --- a/src/uosc/elements/Timeline.lua +++ b/src/uosc/elements/Timeline.lua @@ -373,14 +373,15 @@ function Timeline:render() if text_opacity > 0 then local time_opts = {size = self.font_size, opacity = text_opacity, border = 2 * state.scale} -- Upcoming cache time - if state.cache_duration and options.buffered_time_threshold > 0 - and state.cache_duration < options.buffered_time_threshold then + local cache_duration = state.cache_duration and state.cache_duration / state.speed or nil + if cache_duration and options.buffered_time_threshold > 0 + and cache_duration < options.buffered_time_threshold then local margin = 5 * state.scale local x, align = fbx + margin, 4 local cache_opts = { size = self.font_size * 0.8, opacity = text_opacity * 0.6, border = options.text_border * state.scale, } - local human = round(state.cache_duration / state.speed) .. 's' + local human = round(cache_duration) .. 's' local width = text_width(human, cache_opts) local time_width = timestamp_width(state.time_human, time_opts) local time_width_end = timestamp_width(state.destination_time_human, time_opts)