Gives a minial cell size in the horizontal candidate window.

It prevents the size of the window from being always changing when using
the punctuation list.
This commit is contained in:
zonble 2022-01-30 03:50:18 +08:00
parent 4c358c1c1d
commit 4466564e25
1 changed files with 2 additions and 1 deletions

View File

@ -64,7 +64,8 @@ fileprivate class HorizontalCandidateView: NSView {
for index in 0..<count { for index in 0..<count {
let labelRect = (keyLabels[index] as NSString).boundingRect(with: baseSize, options: .usesLineFragmentOrigin, attributes: keyLabelAttrDict) let labelRect = (keyLabels[index] as NSString).boundingRect(with: baseSize, options: .usesLineFragmentOrigin, attributes: keyLabelAttrDict)
let candidateRect = (displayedCandidates[index] as NSString).boundingRect(with: baseSize, options: .usesLineFragmentOrigin, attributes: candidateAttrDict) let candidateRect = (displayedCandidates[index] as NSString).boundingRect(with: baseSize, options: .usesLineFragmentOrigin, attributes: candidateAttrDict)
let cellWidth = max(labelRect.size.width, candidateRect.size.width) + cellPadding; let cellWidth = max(keyLabelHeight * 2,
max(labelRect.size.width, candidateRect.size.width)) + cellPadding;
newWidths.append(cellWidth) newWidths.append(cellWidth)
} }
elementWidths = newWidths elementWidths = newWidths