Voltaire // Giving a minimum width to cells.

- This is to make sure the width of the window won't be altered by the width differences of single candidate glyphs.
- We choose a different approach to achieve this function here due to the UI design of the Voltaire Candidate Windows used in vChewing.
This commit is contained in:
ShikiSuen 2022-02-10 13:40:32 +08:00
parent 8b26a189f0
commit 2f94394430
1 changed files with 5 additions and 1 deletions

View File

@ -63,7 +63,11 @@ fileprivate class HorizontalCandidateView: NSView {
let baseSize = NSSize(width: 10240.0, height: 10240.0)
for index in 0..<count {
let rctCandidate = (dispCandidatesWithLabels[index] as NSString).boundingRect(with: baseSize, options: .usesLineFragmentOrigin, attributes: candidateWithLabelAttrDict)
let cellWidth = rctCandidate.size.width + cellPadding
var cellWidth = rctCandidate.size.width + cellPadding
let cellHeight = rctCandidate.size.height + cellPadding
if cellWidth < cellHeight * 1.35 {
cellWidth = cellHeight * 1.35
}
newWidths.append(cellWidth)
}
elementWidths = newWidths