mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ignore clicks that dont correspond to SMIL elements
This commit is contained in:
parent
e23664383d
commit
f25465a49d
@ -1031,7 +1031,7 @@ class IframeBoss:
|
||||
par = None
|
||||
else:
|
||||
par = smil_element_at(data.pos, self.smil_anchor_map, self.smil_par_list)
|
||||
self.send_message('audio_ebook_message', type='start_play_at', par=par or None, anchor=data.anchor or None)
|
||||
self.send_message('audio_ebook_message', type='start_play_at', par=par or None, anchor=data.anchor or None, pos=data.pos or None)
|
||||
else:
|
||||
console.error(f'Unknown audio ebook message type from main: {data.type}')
|
||||
|
||||
|
@ -356,6 +356,11 @@ class ReadAudioEbook:
|
||||
# start playing from where we are
|
||||
self.send_message('play')
|
||||
return
|
||||
if message.pos:
|
||||
# this is a click ignore it as no smil element was found at
|
||||
# click location
|
||||
pass
|
||||
else:
|
||||
self.pause()
|
||||
error_dialog(_('Audio element not found'), _(
|
||||
'Could not play audio as no associated audio was found'))
|
||||
|
@ -110,8 +110,7 @@ def smil_element_at(pos, anchor_map, par_list):
|
||||
br = af.get_bounding_client_rect(elem)
|
||||
if br.x <= pos.x <= (br.x + br.width) and br.y <= pos.y <= (br.y + br.height):
|
||||
return par
|
||||
# fallback to first visible anchor
|
||||
return smil_element_at(None, anchor_map, par_list)
|
||||
return None
|
||||
else: # use first visible anchor
|
||||
for par in par_list:
|
||||
if par.anchor and par.audio and is_anchor_on_screen(par.anchor):
|
||||
|
Loading…
x
Reference in New Issue
Block a user