Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9ec9fea
change night mode bg color
SukritChat Dec 19, 2022
973917f
feat(NM-867): add fonts Sarabun family
wisawaDekd Dec 19, 2022
6782c63
Merge remote-tracking branch 'origin/feature/NM-867_fonts-ebook-reade…
SukritChat Dec 19, 2022
ab62826
add font
SukritChat Dec 19, 2022
de5f2da
try add break word
SukritChat Dec 20, 2022
a9d07f4
disable userSelect
SukritChat Dec 22, 2022
8b7df73
fix js script
SukritChat Dec 22, 2022
9158f62
Merge pull request #1 from Dek-D/develop
topdiary Dec 22, 2022
bb720fa
Merge pull request #2 from Dek-D/staging
topdiary Dec 22, 2022
6ead8e2
try fix font
SukritChat Dec 26, 2022
4c65434
try to fix font buy delete https
SukritChat Dec 26, 2022
f93159d
try add https
SukritChat Dec 26, 2022
65fdb3c
Merge pull request #3 from Dek-D/develop
topdiary Dec 26, 2022
47a87e6
Merge pull request #4 from Dek-D/staging
topdiary Dec 26, 2022
2da1ac1
add font th sarabun new
SukritChat May 16, 2023
430facb
Merge pull request #5 from Dek-D/feature/NM-1104_add-local-font
SukritChat May 16, 2023
1ffba8f
Merge pull request #6 from Dek-D/develop
topdiary May 16, 2023
f3027e5
fix font order
SukritChat May 17, 2023
101ea2b
Merge pull request #7 from Dek-D/feature/NM-1104_add-local-font
topdiary May 17, 2023
4310cf8
Merge branch 'staging' into release
SukritChat Sep 22, 2023
c0e8085
Merge branch 'main' into staging
SukritChat Sep 27, 2023
efe8406
Merge branch 'staging' into release
SukritChat Sep 27, 2023
87a1a9e
Merge branch 'main' into hotfix/update-readium
SukritChat Dec 27, 2024
ed675bf
feat(NM-2213): change sepia bg color
SukritChat Jan 2, 2025
ccdf9e6
Merge pull request #1 from Dek-D/hotfix/update-readium
topdiary Jan 2, 2025
d80f162
feat: update scroll navigation
phiraphongbenzz May 10, 2026
27d6395
feat: add scroll vertical flag
phiraphongbenzz May 11, 2026
4d18b4a
refactor: guard re-entrancy and fix completion handling in navigateVe…
phiraphongbenzz May 12, 2026
5022437
refactor: clarify boundary math in scrollViewWillEndDragging
phiraphongbenzz May 12, 2026
52fbc29
refactor: remove redundant _ = and completion: {} in didRequestChapte…
phiraphongbenzz May 12, 2026
7fcc2d9
Merge pull request #2 from Dek-D/feature/vertical-scroll-chapter-navi…
phiraphongbenzz May 13, 2026
a3ca6c7
fix: scroll bounces
phiraphongbenzz May 13, 2026
1f773d8
Merge pull request #4 from Dek-D/hotfix/scroll-bounces
phiraphongbenzz May 13, 2026
7211b73
fix: scroll offset cover image
phiraphongbenzz May 13, 2026
55657fc
Merge pull request #5 from Dek-D/hotfix/scroll-bounces
phiraphongbenzz May 13, 2026
459c3b7
feat: update sepia text color
phiraphongbenzz May 13, 2026
0d51c4a
Merge pull request #6 from Dek-D/hotfix/change-sepia-text-color
phiraphongbenzz May 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: update scroll navigation
  • Loading branch information
phiraphongbenzz committed May 10, 2026
commit d80f16241cce774f45f345a5b55dc75f23932a4b
106 changes: 106 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Sources/Navigator/EPUB/EPUBNavigatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ open class EPUBNavigatorViewController: UIViewController,
}

view.backgroundColor = settings.effectiveBackgroundColor.uiColor
paginationView.isVerticalChapterTransition = settings.scroll && !settings.verticalText
}

// MARK: - User interactions
Expand Down Expand Up @@ -1150,6 +1151,15 @@ extension EPUBNavigatorViewController: EPUBSpreadViewDelegate {
func spreadViewDidTerminate() {
reloadSpreads(force: true)
}

func spreadView(_ spreadView: EPUBSpreadView, didRequestChapterNavigationForward forward: Bool) {
guard !paginationView.isAnimatingChapterTransition else { return }
if forward {
_ = goForward(animated: true, completion: {})
} else {
_ = goBackward(animated: true, completion: {})
}
}
}

extension EPUBNavigatorViewController: EditingActionsControllerDelegate {
Expand Down
14 changes: 14 additions & 0 deletions Sources/Navigator/EPUB/EPUBReflowableSpreadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,20 @@ final class EPUBReflowableSpreadView: EPUBSpreadView {
NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(notifyPagesDidChange), object: nil)
perform(#selector(notifyPagesDidChange), with: nil, afterDelay: 0.3)
}

func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
guard viewModel.scroll else { return }

let insets = scrollView.contentInset
let atBottom = scrollView.contentOffset.y + scrollView.bounds.height >= scrollView.contentSize.height + insets.bottom - 1
let atTop = scrollView.contentOffset.y <= -insets.top + 1

if atBottom && velocity.y > 1.0 {
delegate?.spreadView(self, didRequestChapterNavigationForward: true)
} else if atTop && velocity.y < -1.0 {
delegate?.spreadView(self, didRequestChapterNavigationForward: false)
}
}
}

/// Determines the Readium CSS stylesheets to use depending on the publication languages and
Expand Down
3 changes: 3 additions & 0 deletions Sources/Navigator/EPUB/EPUBSpreadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ protocol EPUBSpreadViewDelegate: AnyObject {

/// Called when WKWebview terminates
func spreadViewDidTerminate()

/// Called when the user scrolls past the edge of the chapter in scroll mode.
func spreadView(_ spreadView: EPUBSpreadView, didRequestChapterNavigationForward forward: Bool)
}

class EPUBSpreadView: UIView, Loggable, PageView {
Expand Down
59 changes: 59 additions & 0 deletions Sources/Navigator/Toolkit/PaginationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ final class PaginationView: UIView, Loggable {

if currentIndex == index {
scrollToView(at: index, location: location, completion: completion)
} else if isVerticalChapterTransition && animated {
navigateVertically(to: index, location: location, completion: completion)
} else {
fadeToView(at: index, location: location, animated: animated, completion: completion)
}
Expand Down Expand Up @@ -343,6 +345,63 @@ final class PaginationView: UIView, Loggable {
size: scrollView.frame.size
), animated: false)
}

// MARK: - Vertical Chapter Transition

/// When true, chapter-to-chapter transitions use a vertical slide animation
/// (scroll == true && verticalText == false).
var isVerticalChapterTransition: Bool = false {
didSet {
guard oldValue != isVerticalChapterTransition else { return }
// Disable horizontal paging scroll when in vertical scroll mode so
// the WebView's own scroll view handles all touch input.
scrollView.isScrollEnabled = !isVerticalChapterTransition
}
}

var isAnimatingChapterTransition = false

private func navigateVertically(to index: Int, location: PageLocation, completion: @escaping () -> Void = {}) {
isAnimatingChapterTransition = true

let height = bounds.height
let isForward = location != .end
let slideOutY: CGFloat = isForward ? -height : height
let slideInY: CGFloat = isForward ? height : -height

let snapshot = snapshotView(afterScreenUpdates: false)
snapshot?.frame = bounds
if let snapshot = snapshot { addSubview(snapshot) }

// New chapter loads off-screen behind the snapshot.
scrollView.transform = CGAffineTransform(translationX: 0, y: slideInY)

// Phase 1: slide out current content immediately — no waiting.
UIView.animate(withDuration: 0.2, delay: 0, options: .curveEaseIn) {
snapshot?.transform = CGAffineTransform(translationX: 0, y: slideOutY)
}

// Phase 2: slide in new chapter as soon as it finishes loading.
setCurrentIndex(index, location: location) { [weak self] in
guard let self = self else { return }
UIView.animate(
withDuration: 0.25,
delay: 0,
usingSpringWithDamping: 1.0,
initialSpringVelocity: 0.8,
options: [],
animations: {
self.scrollView.transform = .identity
},
completion: { [weak self] _ in
guard let self = self else { return }
snapshot?.removeFromSuperview()
self.isAnimatingChapterTransition = false
completion()
}
)
}
}
}

extension PaginationView: UIScrollViewDelegate {
Expand Down
Loading