Merge pull request #578 from stonerl/description-fix

macOS: disable hit testing when not expanded
This commit is contained in:
Arkadiusz Fal 2023-12-09 21:01:30 +01:00 committed by GitHub
commit 3144b52b55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,27 +56,24 @@ struct VideoDescription: View {
}
}
var shouldExpand: Bool {
expand
}
@ViewBuilder var textDescription: some View {
#if canImport(AppKit)
Group {
if #available(macOS 12, *) {
DescriptionWithLinks(description: description, detailsSize: detailsSize)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(shouldExpand ? 500 : collapsedLinesDescription)
.lineLimit(expand ? 500 : collapsedLinesDescription)
.textSelection(.enabled)
} else {
Text(description)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(shouldExpand ? 500 : collapsedLinesDescription)
.lineLimit(expand ? 500 : collapsedLinesDescription)
}
}
.multilineTextAlignment(.leading)
.font(.system(size: 14))
.lineSpacing(3)
.allowsHitTesting(expand)
#endif
}