From f8aa0936560519fbc04b2be4542c7da89ff3ba17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Menu?= Date: Tue, 16 Jul 2024 14:30:01 +0200 Subject: [PATCH 1/2] Report the current locator as first visible element locator in an FXL. --- .../navigator/epub/EpubNavigatorFragment.kt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/readium/navigator/src/main/java/org/readium/r2/navigator/epub/EpubNavigatorFragment.kt b/readium/navigator/src/main/java/org/readium/r2/navigator/epub/EpubNavigatorFragment.kt index 3fac31a779..1234ec8489 100644 --- a/readium/navigator/src/main/java/org/readium/r2/navigator/epub/EpubNavigatorFragment.kt +++ b/readium/navigator/src/main/java/org/readium/r2/navigator/epub/EpubNavigatorFragment.kt @@ -1008,12 +1008,19 @@ public class EpubNavigatorFragment internal constructor( override suspend fun firstVisibleElementLocator(): Locator? { if (!::resourcePager.isInitialized) return null - val resource = readingOrder[resourcePager.currentItem] - return currentReflowablePageFragment?.webView?.findFirstVisibleLocator() - ?.copy( - href = resource.url(), - mediaType = resource.mediaType ?: MediaType.XHTML - ) + return when (viewModel.layout) { + EpubLayout.FIXED -> + currentLocator.value + + EpubLayout.REFLOWABLE -> { + val resource = readingOrder[resourcePager.currentItem] + currentReflowablePageFragment?.webView?.findFirstVisibleLocator() + ?.copy( + href = resource.url(), + mediaType = resource.mediaType ?: MediaType.XHTML + ) + } + } } /** From 6c3d84d660dde23a2d2c7b9d2f64471e59bf41eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Menu?= Date: Tue, 13 Aug 2024 14:43:40 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 907b50973b..881dd321ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. Take a look #### Navigator * Fixed computing the total progression of audiobook locators. +* Fixed starting the TTS from the current resource in a fixed-layout EPUB. ## [3.0.0-beta.2]