mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-02-16 17:55:13 +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
|
@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 {
|
var availableWidth: CGFloat {
|
||||||
#if os(visionOS)
|
#if os(visionOS)
|
||||||
return sceneDelegate.windowWidth * 0.96
|
return sceneDelegate.windowWidth * 0.96
|
||||||
|
@ -78,13 +91,14 @@ public struct StatusRowMediaPreviewView: View {
|
||||||
.accessibilityAddTraits([.isButton, .isImage])
|
.accessibilityAddTraits([.isButton, .isImage])
|
||||||
.onTapGesture { tabAction(for: 0) }
|
.onTapGesture { tabAction(for: 0) }
|
||||||
} else {
|
} else {
|
||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: showsScrollIndicators) {
|
||||||
HStack {
|
HStack {
|
||||||
makeAttachmentView(for: 0)
|
makeAttachmentView(for: 0)
|
||||||
makeAttachmentView(for: 1)
|
makeAttachmentView(for: 1)
|
||||||
makeAttachmentView(for: 2)
|
makeAttachmentView(for: 2)
|
||||||
makeAttachmentView(for: 3)
|
makeAttachmentView(for: 3)
|
||||||
}
|
}
|
||||||
|
.padding(.bottom, scrollBottomPadding)
|
||||||
}
|
}
|
||||||
.scrollClipDisabled()
|
.scrollClipDisabled()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue