- 实现EPUB阅读器搜索功能及选中注释功能 - 优化CFI模块,修复代码审查发现的11个问题 - 实现大书远距目录跳转与后台补全优化方案 - 优化设置面板与章节运行时联动 - 重构及大量改进优化
30 lines
854 B
Swift
30 lines
854 B
Swift
|
|
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
|
|
}
|
|
}
|