TDKCandidates // Optimizing reverse lookup display for SwiftUI.
This commit is contained in:
parent
90f6fa53b8
commit
6fb1d9ee1d
|
@ -248,18 +248,16 @@ extension VwrCandidateTDK {
|
||||||
positionLabelView
|
positionLabelView
|
||||||
if controller?.delegate?.showReverseLookupResult ?? true {
|
if controller?.delegate?.showReverseLookupResult ?? true {
|
||||||
if !firstReverseLookupResult.isEmpty {
|
if !firstReverseLookupResult.isEmpty {
|
||||||
ZStack(alignment: .center) {
|
Text(firstReverseLookupResult)
|
||||||
Text(firstReverseLookupResult)
|
.font(.system(size: max(ceil(CandidateCellData.unifiedSize * 0.6), 9)))
|
||||||
.font(.system(size: max(ceil(CandidateCellData.unifiedSize * 0.6), 9)))
|
.frame(
|
||||||
.frame(
|
width: getTextWidth(
|
||||||
width: getTextWidth(
|
text: firstReverseLookupResult,
|
||||||
text: firstReverseLookupResult,
|
fontSize: max(ceil(CandidateCellData.unifiedSize * 0.6), 9),
|
||||||
fontSize: max(ceil(CandidateCellData.unifiedSize * 0.6), 9),
|
isBold: false
|
||||||
isBold: false
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.opacity(0.8).padding([.leading], 9)
|
)
|
||||||
}.fixedSize()
|
.opacity(0.8).padding([.leading], 9)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,20 +269,10 @@ extension VwrCandidateTDK {
|
||||||
|
|
||||||
var reverseLookupPane: some View {
|
var reverseLookupPane: some View {
|
||||||
HStack(alignment: .center, spacing: 2) {
|
HStack(alignment: .center, spacing: 2) {
|
||||||
if thePool.maxLinesPerPage == 1 {
|
let text = (thePool.maxLinesPerPage == 1) ? firstReverseLookupResult : reverseLookupResult.joined(separator: " ")
|
||||||
if !firstReverseLookupResult.isEmpty {
|
if !reverseLookupResult.joined().trimmingCharacters(in: .newlines).isEmpty {
|
||||||
ZStack(alignment: .center) {
|
Text(verbatim: "\(text.trimmingCharacters(in: .newlines))")
|
||||||
Text("\(firstReverseLookupResult.trimmingCharacters(in: .newlines))")
|
.lineLimit(1).padding([.horizontal], 2).fixedSize()
|
||||||
.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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.font(.system(size: max(ceil(CandidateCellData.unifiedSize * 0.6), 9)))
|
.font(.system(size: max(ceil(CandidateCellData.unifiedSize * 0.6), 9)))
|
||||||
|
|
Loading…
Reference in New Issue