@@ -68,6 +68,9 @@ open class EPUBNavigatorViewController: UIViewController,
68
68
/// `UIViewController` wrapping the `EPUBNavigatorViewController`.
69
69
public var editingActions : [ EditingAction ]
70
70
71
+ /// Disables horizontal page turning when scroll is enabled.
72
+ public var disablePageTurnsWhileScrolling : Bool
73
+
71
74
/// Content insets used to add some vertical margins around reflowable EPUB publications.
72
75
/// The insets can be configured for each size class to allow smaller margins on compact
73
76
/// screens.
@@ -92,14 +95,12 @@ open class EPUBNavigatorViewController: UIViewController,
92
95
93
96
/// Logs the state changes when true.
94
97
public var debugState : Bool
95
-
96
- /// Disables horizontal page turning when scroll is enabled.
97
- public let disablePageTurnsWhileScrolling : Bool
98
-
98
+
99
99
public init (
100
100
preferences: EPUBPreferences = . empty,
101
101
defaults: EPUBDefaults = EPUBDefaults ( ) ,
102
102
editingActions: [ EditingAction ] = EditingAction . defaultActions,
103
+ disablePageTurnsWhileScrolling: Bool = false ,
103
104
contentInset: [ UIUserInterfaceSizeClass : EPUBContentInsets ] = [
104
105
. compact: ( top: 20 , bottom: 20 ) ,
105
106
. regular: ( top: 44 , bottom: 44 ) ,
@@ -109,20 +110,19 @@ open class EPUBNavigatorViewController: UIViewController,
109
110
decorationTemplates: [ Decoration . Style . Id : HTMLDecorationTemplate ] = HTMLDecorationTemplate . defaultTemplates ( ) ,
110
111
fontFamilyDeclarations: [ AnyHTMLFontFamilyDeclaration ] = [ ] ,
111
112
readiumCSSRSProperties: CSSRSProperties = CSSRSProperties ( ) ,
112
- debugState: Bool = false ,
113
- disablePageTurnsWhileScrolling: Bool = false
113
+ debugState: Bool = false
114
114
) {
115
115
self . preferences = preferences
116
116
self . defaults = defaults
117
117
self . editingActions = editingActions
118
+ self . disablePageTurnsWhileScrolling = disablePageTurnsWhileScrolling
118
119
self . contentInset = contentInset
119
120
self . preloadPreviousPositionCount = preloadPreviousPositionCount
120
121
self . preloadNextPositionCount = preloadNextPositionCount
121
122
self . decorationTemplates = decorationTemplates
122
123
self . fontFamilyDeclarations = fontFamilyDeclarations
123
124
self . readiumCSSRSProperties = readiumCSSRSProperties
124
125
self . debugState = debugState
125
- self . disablePageTurnsWhileScrolling = disablePageTurnsWhileScrolling
126
126
}
127
127
}
128
128
@@ -522,7 +522,7 @@ open class EPUBNavigatorViewController: UIViewController,
522
522
frame: . zero,
523
523
preloadPreviousPositionCount: hasPositions ? config. preloadPreviousPositionCount : 0 ,
524
524
preloadNextPositionCount: hasPositions ? config. preloadNextPositionCount : 0 ,
525
- isScrollEnabled: isPaginationViewScrollingEnabled ( with : settings )
525
+ isScrollEnabled: isPaginationViewScrollingEnabled
526
526
)
527
527
view. delegate = self
528
528
view. backgroundColor = . clear
@@ -614,10 +614,10 @@ open class EPUBNavigatorViewController: UIViewController,
614
614
615
615
// MARK: - Navigator
616
616
617
- private func isPaginationViewScrollingEnabled( with settings : EPUBSettings ) -> Bool {
617
+ private var isPaginationViewScrollingEnabled : Bool {
618
618
!( config. disablePageTurnsWhileScrolling && settings. scroll)
619
619
}
620
-
620
+
621
621
public var presentation : VisualNavigatorPresentation {
622
622
VisualNavigatorPresentation (
623
623
readingProgression: settings. readingProgression,
@@ -854,6 +854,7 @@ open class EPUBNavigatorViewController: UIViewController,
854
854
}
855
855
856
856
view. backgroundColor = settings. effectiveBackgroundColor. uiColor
857
+ paginationView. isScrollEnabled = isPaginationViewScrollingEnabled
857
858
}
858
859
859
860
// MARK: - User interactions
@@ -912,7 +913,7 @@ open class EPUBNavigatorViewController: UIViewController,
912
913
extension EPUBNavigatorViewController : EPUBNavigatorViewModelDelegate {
913
914
func epubNavigatorViewModelInvalidatePaginationView( _ viewModel: EPUBNavigatorViewModel ) {
914
915
Task {
915
- paginationView. isScrollEnabled = isPaginationViewScrollingEnabled ( with : viewModel . settings )
916
+ paginationView. isScrollEnabled = isPaginationViewScrollingEnabled
916
917
await reloadSpreads ( force: true )
917
918
}
918
919
}
0 commit comments