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:
parent
0acffd2367
commit
d5032d9546
|
@ -63,7 +63,11 @@ fileprivate class HorizontalCandidateView: NSView {
|
||||||
let baseSize = NSSize(width: 10240.0, height: 10240.0)
|
let baseSize = NSSize(width: 10240.0, height: 10240.0)
|
||||||
for index in 0..<count {
|
for index in 0..<count {
|
||||||
let rctCandidate = (dispCandidatesWithLabels[index] as NSString).boundingRect(with: baseSize, options: .usesLineFragmentOrigin, attributes: candidateWithLabelAttrDict)
|
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)
|
newWidths.append(cellWidth)
|
||||||
}
|
}
|
||||||
elementWidths = newWidths
|
elementWidths = newWidths
|
||||||
|
|
Loading…
Reference in New Issue