mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 02:01:02 +00:00
add scroll bar in StatusRowMediaPreviewView
for macOS version (#1896)
This commit is contained in:
parent
f12d0600f7
commit
bf7cdc3712
1 changed files with 15 additions and 1 deletions
|
@ -22,6 +22,19 @@ public struct StatusRowMediaPreviewView: View {
|
|||
|
||||
@State private var isQuickLookLoading: Bool = false
|
||||
|
||||
init(attachments: [MediaAttachment], sensitive: Bool) {
|
||||
self.attachments = attachments
|
||||
self.sensitive = sensitive
|
||||
}
|
||||
|
||||
#if targetEnvironment(macCatalyst)
|
||||
private var showsScrollIndicators: Bool { attachments.count > 1 }
|
||||
private var scrollBottomPadding: CGFloat?
|
||||
#else
|
||||
private var showsScrollIndicators: Bool = false
|
||||
private var scrollBottomPadding: CGFloat? = 0
|
||||
#endif
|
||||
|
||||
var availableWidth: CGFloat {
|
||||
#if os(visionOS)
|
||||
return sceneDelegate.windowWidth * 0.96
|
||||
|
@ -78,13 +91,14 @@ public struct StatusRowMediaPreviewView: View {
|
|||
.accessibilityAddTraits([.isButton, .isImage])
|
||||
.onTapGesture { tabAction(for: 0) }
|
||||
} else {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
ScrollView(.horizontal, showsIndicators: showsScrollIndicators) {
|
||||
HStack {
|
||||
makeAttachmentView(for: 0)
|
||||
makeAttachmentView(for: 1)
|
||||
makeAttachmentView(for: 2)
|
||||
makeAttachmentView(for: 3)
|
||||
}
|
||||
.padding(.bottom, scrollBottomPadding)
|
||||
}
|
||||
.scrollClipDisabled()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue