Skip to content

Commit

Permalink
fix: better thumbnail clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
po5 committed Oct 31, 2022
1 parent a54b630 commit 2c58823
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions scripts/uosc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions scripts/uosc_shared/elements/Timeline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()

Expand Down Expand Up @@ -335,6 +335,8 @@ function Timeline:render()
})
end
end
else
clear_thumbnail()
end

return ass
Expand Down

0 comments on commit 2c58823

Please sign in to comment.