Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Fix minor bug when orientation changes for mode sectionHorizontalContentVertical #114

Merged
merged 4 commits into from Aug 12, 2016

Conversation

PanajotisMaroungas
Copy link
Contributor

No description provided.

@hebertialmeida
Copy link
Member

Is it to fix #111? I tested but not fixed that.

@PanajotisMaroungas
Copy link
Contributor Author

No, it fixes problem for the swipe/scroll mode. The Font menu bug is in every scrollDirection.
I tested the latest pods (which doesn’t include the last PR) and it bug existed.
I think it will be fixed with some constraints. Should I check it?

On 12 Aug 2016, at 14:36, Heberti Almeida notifications@github.com wrote:

Is it to fix #111 https://github.com/FolioReader/FolioReaderKit/issues/111? I tested but not fixed that.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #114 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AOcLE94N2LmXKr1lMdzT8dkMNox1VWApks5qfGi_gaJpZM4Ji4M4.

@hebertialmeida
Copy link
Member

hebertialmeida commented Aug 12, 2016

We have to do a lot of hacks because this new layout direction, because when I created this generic function I did not prevent your new layout.

I think the best and less buggy what is to refactor this func:
https://github.com/FolioReader/FolioReaderKit/blob/master/Source/FolioReaderKit.swift#L210

To support 3 layouts, so we don't need if else for this.

func isDirection<T> (vertical: T, _ horizontal: T, _ horizontalContentVertical: T) -> T {
    switch readerConfig.scrollDirection {
    case .vertical: return vertical
    case .horizontal: return horizontal
    case .sectionHorizontalContentVertical: return horizontalContentVertical
    }
}

Also I think we can rename the enum case sectionHorizontalContentVertical to horizontalWithVerticalContent, what so you think?

@PanajotisMaroungas
Copy link
Contributor Author

PanajotisMaroungas commented Aug 12, 2016

You’re right. I will start with this now!

} else if let offset = isVerticalDirection(position["pageOffsetY"], position["pageOffsetX"]) as? CGFloat {
pageOffset = offset
}
let offset = isDirection(position["pageOffsetY"], position["pageOffsetX"], position["pageOffsetY"]) as? CGFloat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saved many lines of code 💥

@hebertialmeida hebertialmeida merged commit 2767561 into FolioReader:master Aug 12, 2016
@hebertialmeida hebertialmeida self-assigned this Sep 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants