fix: controls activating when overlapping chapter is clicked (#373)

This commit is contained in:
christoph-heinrich
2022-11-17 09:37:10 +01:00
committed by GitHub
parent 6b2476bace
commit b75ceb6d6f
2 changed files with 4 additions and 0 deletions

View File

@@ -24,6 +24,8 @@ end
function Button:on_coordinates() self.font_size = round((self.by - self.ay) * 0.7) end function Button:on_coordinates() self.font_size = round((self.by - self.ay) * 0.7) end
function Button:on_mbtn_left_down() function Button:on_mbtn_left_down()
-- Don't accept clicks while hidden.
if self:get_visibility() <= 0 then return end
-- We delay the callback to next tick, otherwise we are risking race -- We delay the callback to next tick, otherwise we are risking race
-- conditions as we are in the middle of event dispatching. -- conditions as we are in the middle of event dispatching.
-- For example, handler might add a menu to the end of the element stack, and that -- For example, handler might add a menu to the end of the element stack, and that

View File

@@ -45,6 +45,8 @@ function Speed:speed_step(speed, up)
end end
function Speed:on_mbtn_left_down() function Speed:on_mbtn_left_down()
-- Don't accept clicks while hidden.
if self:get_visibility() <= 0 then return end
self:tween_stop() -- Stop and cleanup possible ongoing animations self:tween_stop() -- Stop and cleanup possible ongoing animations
self.dragging = { self.dragging = {
start_time = mp.get_time(), start_time = mp.get_time(),