ctlCandUniv // Tweaking visual appearance.

This commit is contained in:
ShikiSuen 2022-08-14 12:23:30 +08:00
parent 53dc7cc74b
commit 5131fb523c
1 changed files with 7 additions and 12 deletions

View File

@ -184,8 +184,8 @@ private class vwrCandidateUniversal: NSView {
.withAlphaComponent(0.84) .withAlphaComponent(0.84)
// Highlightened phrase text color // Highlightened phrase text color
activeCandidateAttr[.foregroundColor] = NSColor.selectedMenuItemTextColor activeCandidateAttr[.foregroundColor] = NSColor.selectedMenuItemTextColor
} else { let path: NSBezierPath = .init(roundedRect: rctCandidateArea, xRadius: 6, yRadius: 6)
NSColor.controlBackgroundColor.setFill() path.fill()
} }
if mgrPrefs.handleDefaultCandidateFontsByLangIdentifier { if mgrPrefs.handleDefaultCandidateFontsByLangIdentifier {
switch IME.currentInputMode { switch IME.currentInputMode {
@ -203,8 +203,6 @@ private class vwrCandidateUniversal: NSView {
break break
} }
} }
let path: NSBezierPath = .init(roundedRect: rctCandidateArea, xRadius: 5, yRadius: 5)
path.fill()
(keyLabels[index] as NSString).draw( (keyLabels[index] as NSString).draw(
in: rctLabel, withAttributes: activeCandidateIndexAttr in: rctLabel, withAttributes: activeCandidateIndexAttr
) )
@ -257,8 +255,8 @@ private class vwrCandidateUniversal: NSView {
.withAlphaComponent(0.84) .withAlphaComponent(0.84)
// Highlightened phrase text color // Highlightened phrase text color
activeCandidateAttr[.foregroundColor] = NSColor.selectedMenuItemTextColor activeCandidateAttr[.foregroundColor] = NSColor.selectedMenuItemTextColor
} else { let path: NSBezierPath = .init(roundedRect: rctCandidateArea, xRadius: 6, yRadius: 6)
NSColor.controlBackgroundColor.setFill() path.fill()
} }
if mgrPrefs.handleDefaultCandidateFontsByLangIdentifier { if mgrPrefs.handleDefaultCandidateFontsByLangIdentifier {
switch IME.currentInputMode { switch IME.currentInputMode {
@ -276,8 +274,6 @@ private class vwrCandidateUniversal: NSView {
break break
} }
} }
let path: NSBezierPath = .init(roundedRect: rctCandidateArea, xRadius: 5, yRadius: 5)
path.fill()
(keyLabels[index] as NSString).draw( (keyLabels[index] as NSString).draw(
in: rctLabel, withAttributes: activeCandidateIndexAttr in: rctLabel, withAttributes: activeCandidateIndexAttr
) )
@ -382,11 +378,10 @@ public class ctlCandidateUniversal: ctlCandidate {
candidateView = vwrCandidateUniversal(frame: contentRect) candidateView = vwrCandidateUniversal(frame: contentRect)
candidateView.wantsLayer = true candidateView.wantsLayer = true
candidateView.layer?.borderColor = // candidateView.layer?.borderColor = NSColor.selectedMenuItemTextColor.withAlphaComponent(0.20).cgColor
NSColor.selectedMenuItemTextColor.withAlphaComponent(0.20).cgColor // candidateView.layer?.borderWidth = 1.0
candidateView.layer?.borderWidth = 1.0
if #available(macOS 10.13, *) { if #available(macOS 10.13, *) {
candidateView.layer?.cornerRadius = 8.0 candidateView.layer?.cornerRadius = 9.0
} }
panel.contentView?.addSubview(candidateView) panel.contentView?.addSubview(candidateView)