-
Notifications
You must be signed in to change notification settings - Fork 783
Fix scroll direction being ignored on first run #178
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ open class FolioReaderContainer: UIViewController { | |
| kCurrentHighlightStyle: 0, | ||
| kCurrentTOCMenu: 0, | ||
| kCurrentMediaOverlayStyle: MediaOverlayStyle.default.rawValue, | ||
| kCurrentScrollDirection: FolioReaderScrollDirection.vertical.rawValue | ||
| kCurrentScrollDirection: FolioReaderScrollDirection.defaultVertical.rawValue | ||
| ]) | ||
| } | ||
|
|
||
|
|
@@ -95,8 +95,13 @@ open class FolioReaderContainer: UIViewController { | |
|
|
||
| // If user can change scroll direction use the last saved | ||
| if readerConfig.canChangeScrollDirection { | ||
| let direction = FolioReaderScrollDirection(rawValue: FolioReader.currentScrollDirection) ?? .vertical | ||
| readerConfig.scrollDirection = direction | ||
| var scrollDirection = FolioReaderScrollDirection(rawValue: FolioReader.currentScrollDirection) ?? .vertical | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This loads the persisted scroll direction, which, in the first app run, is |
||
|
|
||
| if (scrollDirection == .defaultVertical && readerConfig.scrollDirection != .defaultVertical) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the persisted value is |
||
| scrollDirection = readerConfig.scrollDirection | ||
| } | ||
|
|
||
| readerConfig.scrollDirection = scrollDirection | ||
| } | ||
|
|
||
| readerConfig.shouldHideNavigationOnTap = ((readerConfig.hideBars == true) ? true : readerConfig.shouldHideNavigationOnTap) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,7 +234,14 @@ class FolioReaderFontsMenu: UIViewController, SMSegmentViewDelegate, UIGestureRe | |
| layoutDirection.tag = 3 | ||
| layoutDirection.addSegmentWithTitle(readerConfig.localizedLayoutVertical, onSelectionImage: verticalSelected, offSelectionImage: verticalNormal) | ||
| layoutDirection.addSegmentWithTitle(readerConfig.localizedLayoutHorizontal, onSelectionImage: horizontalSelected, offSelectionImage: horizontalNormal) | ||
| layoutDirection.selectSegmentAtIndex(Int(FolioReader.currentScrollDirection)) | ||
|
|
||
| var scrollDirection = FolioReaderScrollDirection(rawValue: FolioReader.currentScrollDirection) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't remember why didn't it require me to add |
||
|
|
||
| if scrollDirection == .defaultVertical && readerConfig.scrollDirection != .defaultVertical { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as this comment. |
||
| scrollDirection = readerConfig.scrollDirection | ||
| } | ||
|
|
||
| layoutDirection.selectSegmentAtIndex(scrollDirection?.rawValue ?? 0) | ||
| menuView.addSubview(layoutDirection) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sure the initial value of the scroll direction is the new
.defaultVertical, and not.vertical. This default value works asverticalif the user doesn't sets another value for theconfig's scroll direction.