Skip to content

Commit

Permalink
Merge pull request #1697 from planetary-social/fix-gallery-dot-size
Browse files Browse the repository at this point in the history
fix the size of the dots in the gallery
  • Loading branch information
joshuatbrown authored Nov 27, 2024
2 parents 0dfd5f3 + c9de66d commit 62fdf34
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions Nos/Views/Components/Media/GalleryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,31 +185,18 @@ fileprivate struct GalleryIndexView: View {
/// Calculates the scale factor for a circle at a given index.
///
/// - Parameter index: The index of the page to evaluate.
/// - Returns: A scale factor based on the distance from `currentIndex`.
/// - Returns: A scale factor based on whether it's the current index, and if not, whether it's on the edge.
private func scaleFor(_ index: Int) -> CGFloat {
// Show all circles at full size if there are 6 or fewer pages
if numberOfPages <= maxNumberOfCircles {
return 1.0
}

if index == currentIndex {
return 1.0
}
if displayRange.lowerBound > 0 {
if index == displayRange.lowerBound {
return 0.5
} else if index == displayRange.lowerBound + 1 {
return 0.75
}
if displayRange.lowerBound > 0 && index == displayRange.lowerBound {
return 0.5
}
if displayRange.upperBound < numberOfPages - 1 {
if index == displayRange.upperBound {
return 0.5
} else if index == displayRange.upperBound - 1 {
return 0.75
}
if displayRange.upperBound < numberOfPages - 1 && index == displayRange.upperBound {
return 0.5
}
return 1.0
return 0.75
}
}

Expand Down

0 comments on commit 62fdf34

Please sign in to comment.