refactor: split reader architecture and chrome handling
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import CoreGraphics
|
||||
|
||||
struct RDReaderTapRegionHandler {
|
||||
func resolveTapEvent(
|
||||
point: CGPoint,
|
||||
viewFrame: CGRect,
|
||||
isToolViewVisible: Bool
|
||||
) -> RDReaderView.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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user