Auto scroll update (#7)
* updated auto-scroll logic for EPUB and PDF * Refactored auto-scroll to use temporary debounced pauses instead of hard stops on manual interaction. * Updated tap handling to allow toggling bars without interrupting scroll. * Added a 2-second orientation pause on EPUB chapter transitions. * Enhanced AutoScrollControls UI with circular progress overlay to indicate the "temporarily paused" state. * Refactored auto-scroll controls This commit refactors the auto-scroll controls for both EPUB and PDF readers, introducing a more advanced and user-friendly interface. Key changes: - Redesigned the auto-scroll controls UI into a collapsible and lockable card. - Added a "lock" feature to hide controls during scrolling. - Introduced an alternative slider-based input for speed adjustment, which can be toggled. - Persisted the lock and input mode states in SharedPreferences. - Improved the EPUB auto-scroll mechanism using `translate3d` for smoother sub-pixel scrolling.
This commit is contained in:
parent
1f111034f1
commit
de376e2ace
6 changed files with 410 additions and 238 deletions
|
|
@ -213,6 +213,7 @@ internal fun PdfVerticalReader(
|
|||
topContentPaddingPx: Float = 0f,
|
||||
onTextBoxMoved: (String, Int, Rect) -> Unit = { _, _, _ -> },
|
||||
isAutoScrollPlaying: Boolean = false,
|
||||
isAutoScrollTempPaused: Boolean = false,
|
||||
autoScrollSpeed: Float = 1.0f,
|
||||
onInteractionListener: () -> Unit = {}
|
||||
) {
|
||||
|
|
@ -484,9 +485,9 @@ internal fun PdfVerticalReader(
|
|||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(isAutoScrollPlaying, autoScrollSpeed, totalDocHeight, screenHeight) {
|
||||
if (isAutoScrollPlaying) {
|
||||
val baseSpeedPxPerSec = 30f
|
||||
LaunchedEffect(isAutoScrollPlaying, isAutoScrollTempPaused, autoScrollSpeed, totalDocHeight, screenHeight) {
|
||||
if (isAutoScrollPlaying && !isAutoScrollTempPaused) {
|
||||
val baseSpeedPxPerSec = 80f
|
||||
var lastFrameTime = withFrameNanos { it }
|
||||
|
||||
while (isActive) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue