Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion swiftchan/Views/Boards/Catalog/Thread/PostView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ struct PostView: View {
.onTapGesture {
withAnimation(.easeInOut(duration: 0.3)) {
let mediaIndex = viewModel.postMediaMapping[index] ?? 0
viewModel.media[mediaIndex].isSelected = true
var item = viewModel.media[mediaIndex]
item.isSelected = true
viewModel.media[mediaIndex] = item
presentationState.galleryIndex = mediaIndex
presentationState.presentingGallery = true
}
Expand Down
12 changes: 9 additions & 3 deletions swiftchan/Views/Media/Gallery/GalleryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,18 @@ struct GalleryView: View {
onPageDragChanged?(.zero)
state.galleryIndex = index
if index - 1 >= 0 {
viewModel.media[index - 1].isSelected = false
var item = viewModel.media[index - 1]
item.isSelected = false
viewModel.media[index - 1] = item
}
if index + 1 <= viewModel.media.count - 1 {
viewModel.media[index + 1].isSelected = false
var item = viewModel.media[index + 1]
item.isSelected = false
viewModel.media[index + 1] = item
}
viewModel.media[index].isSelected = true
var currentItem = viewModel.media[index]
currentItem.isSelected = true
viewModel.media[index] = currentItem
}
.allowsDragging(canPage)
.pagingPriority(.simultaneous)
Expand Down
Loading