TDKCandidates // Optimizing reverse lookup display for SwiftUI.

This commit is contained in:
ShikiSuen 2023-06-05 12:51:21 +08:00
parent 90f6fa53b8
commit 6fb1d9ee1d
1 changed files with 13 additions and 25 deletions

View File

@ -248,7 +248,6 @@ extension VwrCandidateTDK {
positionLabelView
if controller?.delegate?.showReverseLookupResult ?? true {
if !firstReverseLookupResult.isEmpty {
ZStack(alignment: .center) {
Text(firstReverseLookupResult)
.font(.system(size: max(ceil(CandidateCellData.unifiedSize * 0.6), 9)))
.frame(
@ -259,7 +258,6 @@ extension VwrCandidateTDK {
)
)
.opacity(0.8).padding([.leading], 9)
}.fixedSize()
}
}
}
@ -271,20 +269,10 @@ extension VwrCandidateTDK {
var reverseLookupPane: some View {
HStack(alignment: .center, spacing: 2) {
if thePool.maxLinesPerPage == 1 {
if !firstReverseLookupResult.isEmpty {
ZStack(alignment: .center) {
Text("\(firstReverseLookupResult.trimmingCharacters(in: .newlines))")
.lineLimit(1).padding([.horizontal], 2)
}.fixedSize()
}
} else {
ForEach(reverseLookupResult, id: \.self) { currentResult in
ZStack(alignment: .center) {
Text("\(currentResult.trimmingCharacters(in: .newlines))")
.lineLimit(1).padding([.horizontal], 2)
}.fixedSize()
}
let text = (thePool.maxLinesPerPage == 1) ? firstReverseLookupResult : reverseLookupResult.joined(separator: " ")
if !reverseLookupResult.joined().trimmingCharacters(in: .newlines).isEmpty {
Text(verbatim: "\(text.trimmingCharacters(in: .newlines))")
.lineLimit(1).padding([.horizontal], 2).fixedSize()
}
}
.font(.system(size: max(ceil(CandidateCellData.unifiedSize * 0.6), 9)))