diff --git a/Packages/vChewing_CandidateWindow/README.md b/Packages/vChewing_CandidateWindow/README.md index 31da3503..f4370531 100644 --- a/Packages/vChewing_CandidateWindow/README.md +++ b/Packages/vChewing_CandidateWindow/README.md @@ -9,7 +9,7 @@ TDK 選字窗以純 SwiftUI 構築,用以取代此前自上游繼承來的 Vol 然而,TDK 選字窗目前有下述侷限: - 因 SwiftUI 自身特性所導致的嚴重的效能問題。基本上來講,如果您經常使用全字庫模式的話,請在偏好設定內啟用效能更高的 IMK 選字窗。 -- 同樣出於上述原因,為了讓田所選字窗至少處於可在生產力環境下正常使用的狀態,就犧牲了捲動檢視的功能。也就是說,每次只顯示六行,但顯示內容則隨著使用者的游標操作而更新。 +- 同樣出於上述原因,為了讓田所選字窗至少處於可在生產力環境下正常使用的狀態,就犧牲了捲動檢視的功能。也就是說,每次只顯示三行,但顯示內容則隨著使用者的游標操作而更新。 - TDK 選字窗目前僅完成了橫版矩陣陳列模式的實作,且尚未引入對縱排選字窗陳列佈局的支援。 因為這些問題恐怕需要很久才能全部解決,所以威注音會在這段時間內推薦使用者們優先使用 IMK 選字窗。 diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/CandidatePool.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/CandidatePool.swift index 2c090641..31d67658 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/CandidatePool.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/CandidatePool.swift @@ -10,21 +10,24 @@ import Cocoa import Shared /// 候選字窗會用到的資料池單位。 -public struct CandidatePool { +public class CandidatePool { public var currentRowNumber = 0 + public var maximumLinesPerPage = 3 public private(set) var selectionKeys: String public private(set) var highlightedIndex: Int = 0 public private(set) var maxColumnCapacity: Int = 6 public private(set) var candidateDataAll: [CandidateCellData] = [] public private(set) var candidateRows: [[CandidateCellData]] = [] - public var maxWindowHeight: Double { ceil(maxWindowWidth * 0.4) } public var isVerticalLayout: Bool { maxColumnCapacity == 1 } public var maxColumnWidth: Int { Int(Double(maxColumnCapacity + 3) * 2) * Int(ceil(CandidateCellData.unifiedSize)) } + public var maxWindowHeight: Double { ceil(maxWindowWidth * 0.4 / 2) } public var maxWindowWidth: Double { ceil(Double(maxColumnCapacity + 3) * 2.7 * ceil(CandidateCellData.unifiedSize) * 1.2) } - public var rangeForCurrentPage: Range { currentRowNumber.. { + currentRowNumber.. Bool { - for _ in 0..<6 { + for _ in 0.. Bool { - for _ in 0..<6 { + for _ in 0..