Skip to content

Commit

Permalink
Fix crash (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryu0118 authored Sep 19, 2023
1 parent 736558e commit 69921e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/PagerSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public class PagerSettings<SelectionType>: ObservableObject where SelectionType:
@Published private(set) var itemsOrderedByIndex = [SelectionType]()

private func recalculateTransition() {
let indexAndPercentage = -contentOffset / width
let indexAndPercentage = width == 0 ? 0 : -contentOffset / width
let percentage = (indexAndPercentage + 1).truncatingRemainder(dividingBy: 1)
let lowIndex = Int(floor(indexAndPercentage))
transition = TransitionProgress(from: itemsOrderedByIndex[safe: lowIndex], to: itemsOrderedByIndex[safe: lowIndex+1], percentage: percentage)
Expand Down

0 comments on commit 69921e0

Please sign in to comment.