mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
macOS: disable hit testing when not expanded
fixes overspilling of text when clicking on collapsed descriptions
This commit is contained in:
parent
eb1dfe69cd
commit
b04385ceae
@ -56,27 +56,24 @@ struct VideoDescription: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var shouldExpand: Bool {
|
|
||||||
expand
|
|
||||||
}
|
|
||||||
|
|
||||||
@ViewBuilder var textDescription: some View {
|
@ViewBuilder var textDescription: some View {
|
||||||
#if canImport(AppKit)
|
#if canImport(AppKit)
|
||||||
Group {
|
Group {
|
||||||
if #available(macOS 12, *) {
|
if #available(macOS 12, *) {
|
||||||
DescriptionWithLinks(description: description, detailsSize: detailsSize)
|
DescriptionWithLinks(description: description, detailsSize: detailsSize)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.lineLimit(shouldExpand ? 500 : collapsedLinesDescription)
|
.lineLimit(expand ? 500 : collapsedLinesDescription)
|
||||||
.textSelection(.enabled)
|
.textSelection(.enabled)
|
||||||
} else {
|
} else {
|
||||||
Text(description)
|
Text(description)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.lineLimit(shouldExpand ? 500 : collapsedLinesDescription)
|
.lineLimit(expand ? 500 : collapsedLinesDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
.font(.system(size: 14))
|
.font(.system(size: 14))
|
||||||
.lineSpacing(3)
|
.lineSpacing(3)
|
||||||
|
.allowsHitTesting(expand)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user