From 2c588237570623ab649c0df24e0665d0feef580c Mon Sep 17 00:00:00 2001 From: Eva Date: Mon, 31 Oct 2022 13:20:54 +0100 Subject: [PATCH] fix: better thumbnail clearing --- scripts/uosc.lua | 1 + scripts/uosc_shared/elements/Timeline.lua | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/uosc.lua b/scripts/uosc.lua index f0f035211..9b6d55528 100644 --- a/scripts/uosc.lua +++ b/scripts/uosc.lua @@ -543,6 +543,7 @@ mp.observe_property('mouse-pos', 'native', update_mouse_pos) mp.observe_property('osc', 'bool', function(name, value) if value == true then mp.set_property('osc', 'no') end end) function clear_thumbnail() + if not thumbnail_state.render.thumbnail then return end mp.commandv('script-message-to', 'thumbfast', 'clear') thumbnail_state.render.thumbnail = false thumbnail_state.updated = true diff --git a/scripts/uosc_shared/elements/Timeline.lua b/scripts/uosc_shared/elements/Timeline.lua index 54389fe3b..3f57da1f0 100644 --- a/scripts/uosc_shared/elements/Timeline.lua +++ b/scripts/uosc_shared/elements/Timeline.lua @@ -96,17 +96,14 @@ function Timeline:on_prop_time() self:decide_enabled() end function Timeline:on_prop_border() self:update_dimensions() end function Timeline:on_prop_fullormaxed() self:update_dimensions() end function Timeline:on_display() self:update_dimensions() end -function Timeline:on_mouse_leave() clear_thumbnail() end function Timeline:on_global_mbtn_left_up() if self.pressed then mp.set_property_native('pause', self.pressed_pause) self.pressed = false end - clear_thumbnail() end function Timeline:on_global_mouse_leave() self.pressed = false - clear_thumbnail() end Timeline.seek_timer = mp.add_timeout(0.05, function() Elements.timeline:set_from_cursor() end) @@ -130,7 +127,10 @@ function Timeline:render() local size = self:get_effective_size() local visibility = self:get_visibility() - if size < 1 then return end + if size < 1 then + clear_thumbnail() + return + end local ass = assdraw.ass_new() @@ -335,6 +335,8 @@ function Timeline:render() }) end end + else + clear_thumbnail() end return ass