refactor: split reader architecture and chrome handling
This commit is contained in:
@@ -100,6 +100,8 @@ public struct RDEPUBTextLayoutConfig: Equatable {
|
||||
public var hyphenation: Bool
|
||||
/// 图片最大高度占页面高度的比例
|
||||
public var imageMaxHeightRatio: CGFloat
|
||||
/// 当调用方暂时拿不到 pageSize 时,用于估算附件尺寸的兜底 viewport。
|
||||
public var fallbackViewportSize: CGSize
|
||||
|
||||
public init(
|
||||
frameWidth: CGFloat = 0,
|
||||
@@ -111,7 +113,8 @@ public struct RDEPUBTextLayoutConfig: Equatable {
|
||||
avoidWidows: Bool = true,
|
||||
avoidPageBreakInsideEnabled: Bool = true,
|
||||
hyphenation: Bool = true,
|
||||
imageMaxHeightRatio: CGFloat = 0.85
|
||||
imageMaxHeightRatio: CGFloat = 0.85,
|
||||
fallbackViewportSize: CGSize = CGSize(width: 375, height: 667)
|
||||
) {
|
||||
self.frameWidth = frameWidth
|
||||
self.frameHeight = frameHeight
|
||||
@@ -123,6 +126,7 @@ public struct RDEPUBTextLayoutConfig: Equatable {
|
||||
self.avoidPageBreakInsideEnabled = avoidPageBreakInsideEnabled
|
||||
self.hyphenation = hyphenation
|
||||
self.imageMaxHeightRatio = imageMaxHeightRatio
|
||||
self.fallbackViewportSize = fallbackViewportSize
|
||||
}
|
||||
|
||||
/// 默认配置
|
||||
@@ -172,7 +176,9 @@ public struct RDEPUBTextLayoutConfig: Equatable {
|
||||
avoidWidows ? "1" : "0",
|
||||
avoidPageBreakInsideEnabled ? "1" : "0",
|
||||
hyphenation ? "1" : "0",
|
||||
String(format: "%.3f", imageMaxHeightRatio)
|
||||
String(format: "%.3f", imageMaxHeightRatio),
|
||||
String(format: "%.3f", fallbackViewportSize.width),
|
||||
String(format: "%.3f", fallbackViewportSize.height)
|
||||
].joined(separator: "|")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user