TDKCandidates // Set the opacity of the non-current lines to 85%.

This commit is contained in:
ShikiSuen 2023-03-01 12:09:17 +08:00
parent ab4ae41af6
commit c3d5e9aaf8
3 changed files with 4 additions and 3 deletions

View File

@ -41,7 +41,7 @@ extension CandidatePool {
) )
if lineID != currentLineNumber { if lineID != currentLineNumber {
cellString.addAttribute( cellString.addAttribute(
.foregroundColor, value: NSColor.controlTextColor, .foregroundColor, value: NSColor.gray,
range: .init(location: 0, length: cellString.string.utf16.count) range: .init(location: 0, length: cellString.string.utf16.count)
) )
} }

View File

@ -238,6 +238,7 @@ private extension VwrCandidateTDKCocoa {
vwrCurrentLine.layer?.backgroundColor = lineBg.cgColor vwrCurrentLine.layer?.backgroundColor = lineBg.cgColor
vwrCurrentLine.layer?.cornerRadius = 6 vwrCurrentLine.layer?.cornerRadius = 6
} }
vwrCurrentLine.alphaValue = isCurrentLine ? 1 : 0.85
lineDimension.width = max(lineSize.width, lineDimension.width) lineDimension.width = max(lineSize.width, lineDimension.width)
switch thePool.layout { switch thePool.layout {
case .horizontal: lineDimension.height = max(lineSize.height, lineDimension.height) case .horizontal: lineDimension.height = max(lineSize.height, lineDimension.height)

View File

@ -66,7 +66,7 @@ private extension VwrCandidateTDK {
ForEach(Array(thePool.candidateLines[rowIndex]), id: \.self) { currentCandidate in ForEach(Array(thePool.candidateLines[rowIndex]), id: \.self) { currentCandidate in
drawCandidate(currentCandidate).fixedSize() drawCandidate(currentCandidate).fixedSize()
} }
.opacity(rowIndex == thePool.currentLineNumber ? 1 : 0.95) .opacity(rowIndex == thePool.currentLineNumber ? 1 : 0.85)
} }
} }
.id(rowIndex) .id(rowIndex)
@ -100,7 +100,7 @@ private extension VwrCandidateTDK {
ForEach(Array(thePool.candidateLines[columnIndex]), id: \.self) { currentCandidate in ForEach(Array(thePool.candidateLines[columnIndex]), id: \.self) { currentCandidate in
drawCandidate(currentCandidate) drawCandidate(currentCandidate)
} }
.opacity(columnIndex == thePool.currentLineNumber ? 1 : 0.95) .opacity(columnIndex == thePool.currentLineNumber ? 1 : 0.85)
if thePool.candidateLines[columnIndex].count < thePool.maxLineCapacity { if thePool.candidateLines[columnIndex].count < thePool.maxLineCapacity {
ForEach(0 ..< thePool.dummyCellsRequiredForCurrentLine, id: \.self) { _ in ForEach(0 ..< thePool.dummyCellsRequiredForCurrentLine, id: \.self) { _ in
drawCandidate(thePool.blankCell) drawCandidate(thePool.blankCell)