Skip to content

Commit

Permalink
Fix #3046 (With "Text follows speech" option TTS does not highlight g…
Browse files Browse the repository at this point in the history
…enbook text)
  • Loading branch information
tuomas2 committed Jan 18, 2024
1 parent c64c3b7 commit ab99206
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class Window (
val anchorOrdinal = pageManager.currentPage.anchorOrdinal
val htmlId = pageManager.currentPage.htmlId
if(prevKey == key && (anchorOrdinal != null || htmlId != null)) {
bibleView?.scrollOrJumpToOrdinal(anchorOrdinal, htmlId)
bibleView?.scrollOrJumpToOrdinal(anchorOrdinal, htmlId, document?.initials, key?.osisRef)
return
}
loadText(notifyLocationChange = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ class BibleView(val mainBibleActivity: MainBibleActivity,
PassageChangeMediator.onCurrentVerseChanged(window)
}
}
fun scrollOrJumpToOrdinal(ordinal: OrdinalRange?, htmlId: String?, forceNow: Boolean = false) {
fun scrollOrJumpToOrdinal(ordinal: OrdinalRange?, htmlId: String?, bookInitials: String?, osisRef: String?, forceNow: Boolean = false) {
Log.i(TAG, "Scroll or jump to ordinal:$ordinal")
val now = !contentVisible || forceNow
fun boolString(value: Boolean?): String {
Expand All @@ -1751,7 +1751,7 @@ class BibleView(val mainBibleActivity: MainBibleActivity,
val highlight = !contentVisible || ordinal?.end != null
val jumpToId = if(ordinal != null) "o-${ordinal.start}" else htmlId!!

executeJavascriptOnUiThread("bibleView.emit('scroll_to_verse', '$jumpToId', {now: ${boolString(now)}, highlight: ${boolString(highlight)}, ordinalStart: ${ordinal?.start}, ordinalEnd: ${ordinal?.end}});")
executeJavascriptOnUiThread("bibleView.emit('scroll_to_verse', '$jumpToId', {now: ${boolString(now)}, highlight: ${boolString(highlight)}, bookInitials: '$bookInitials', osisRef: '$osisRef', ordinalStart: ${ordinal?.start}, ordinalEnd: ${ordinal?.end}});")
if(isActive) {
PassageChangeMediator.onCurrentVerseChanged(window)
}
Expand Down

0 comments on commit ab99206

Please sign in to comment.