- Rename source module from RDReaderView to RDEpubReaderView - Move all source files from Sources/RDReaderView/ to Sources/RDEpubReaderView/ - Update podspec: RDReaderView.podspec -> RDEpubReaderView.podspec - Update Podfile, demo project, and CocoaPods config for new pod name - Delete old RDReaderView pod support files from ReadViewDemo/Pods - Add new RDEpubReaderView pod support files - Update documentation (API ref, architecture, UML, conventions, etc.) - Add FixedLayoutRotationTests - Update .gitignore: exclude .DS_Store, manual unpack backups, _ssoft-output
30 lines
862 B
Swift
30 lines
862 B
Swift
|
|
import CoreGraphics
|
|
|
|
struct RDEpubReaderTapRegionHandler {
|
|
|
|
func resolveTapEvent(
|
|
point: CGPoint,
|
|
viewFrame: CGRect,
|
|
isToolViewVisible: Bool
|
|
) -> RDEpubReaderView.TapEvent {
|
|
let leftFrame = CGRect(x: 0, y: 0, width: viewFrame.width / 3, height: viewFrame.height)
|
|
let centerFrame = CGRect(x: viewFrame.width / 3, y: 0, width: viewFrame.width / 3, height: viewFrame.height)
|
|
let rightFrame = CGRect(x: viewFrame.width * 2 / 3, y: 0, width: viewFrame.width / 3, height: viewFrame.height)
|
|
|
|
if leftFrame.contains(point) {
|
|
return isToolViewVisible ? .center : .left
|
|
}
|
|
|
|
if centerFrame.contains(point) {
|
|
return .center
|
|
}
|
|
|
|
if rightFrame.contains(point) {
|
|
return isToolViewVisible ? .center : .right
|
|
}
|
|
|
|
return .none
|
|
}
|
|
}
|