mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Have the SMIL bar's opacity behavior match the TTS bar's opacity behavior
This commit is contained in:
parent
2503f2427c
commit
564f2608c1
@ -60,6 +60,10 @@ class ReadAudioEbook:
|
|||||||
style=f'position: absolute; bottom: 0; width: min(600px, 80vw); height: 2em; border-radius: 1em; padding:0.5em; display: flex; justify-content: center; align-items: center; background-color: {get_color("window-background")};'
|
style=f'position: absolute; bottom: 0; width: min(600px, 80vw); height: 2em; border-radius: 1em; padding:0.5em; display: flex; justify-content: center; align-items: center; background-color: {get_color("window-background")};'
|
||||||
))
|
))
|
||||||
bar_container = container.lastChild
|
bar_container = container.lastChild
|
||||||
|
container.appendChild(E.style(
|
||||||
|
f'#{container.id} .speaking '+'{ opacity: 0.5 }\n\n',
|
||||||
|
f'#{container.id} .speaking:hover '+'{ opacity: 1.0 }\n\n',
|
||||||
|
))
|
||||||
container.addEventListener("keydown", self.on_keydown, {"passive": False})
|
container.addEventListener("keydown", self.on_keydown, {"passive": False})
|
||||||
container.addEventListener("click", self.on_container_clicked, {"passive": False})
|
container.addEventListener("click", self.on_container_clicked, {"passive": False})
|
||||||
container.addEventListener("contextmenu", self.toggle, {"passive": False})
|
container.addEventListener("contextmenu", self.toggle, {"passive": False})
|
||||||
@ -234,12 +238,18 @@ class ReadAudioEbook:
|
|||||||
@state.setter
|
@state.setter
|
||||||
def state(self, val):
|
def state(self, val):
|
||||||
if val is not self._state:
|
if val is not self._state:
|
||||||
|
speaking = False
|
||||||
if val is HIDDEN:
|
if val is HIDDEN:
|
||||||
self._state = HIDDEN
|
self._state = HIDDEN
|
||||||
elif val is PLAYING:
|
elif val is PLAYING:
|
||||||
self._state = PLAYING
|
self._state = PLAYING
|
||||||
|
speaking = True
|
||||||
elif val is PAUSED:
|
elif val is PAUSED:
|
||||||
self._state = PAUSED
|
self._state = PAUSED
|
||||||
|
if speaking:
|
||||||
|
self.bar.classList.add('speaking')
|
||||||
|
else:
|
||||||
|
self.bar.classList.remove('speaking')
|
||||||
|
|
||||||
def hide(self):
|
def hide(self):
|
||||||
if self.state is not HIDDEN:
|
if self.state is not HIDDEN:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user