Skip to content

Commit

Permalink
Merge pull request #66 from dscyrescotti/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dscyrescotti authored Dec 26, 2022
2 parents 6b75b5e + e418946 commit b1b963c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Sources/CarouselStack/View/CarouselStack+Sliding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ extension CarouselStack {
self.autoSliding = true
self.direction = direction
performMovingToMiddle()
DispatchQueue.main.asyncAfter(deadline: .now() + duration(0.11)) {
DispatchQueue.main.asyncAfter(deadline: .now() + duration(0.12)) {
self.performRestoring()
}
}

/// A method that mimics sliding behaviour to slide view to left or right for the purpose of programmatic sliding.
internal func performMovingToMiddle() {
let maXSwipeDistance = size.width * 0.6
withAnimation(animation.timing(duration: duration(0.1))) {
withAnimation(animation.timing(duration: duration(0.12))) {
switch direction {
case .left:
xPosition = maXSwipeDistance
Expand Down Expand Up @@ -45,8 +45,8 @@ extension CarouselStack {
index = newIndex
direction = .right
notifyListener(context: context)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.005) {
withAnimation(animation.timing(duration: duration(0.1))) {
DispatchQueue.main.asyncAfter(deadline: .now() + (autoSliding ? 0 : 0.005)) {
withAnimation(animation.timing(duration: duration(0.12))) {
xPosition = 0
autoSliding = false
}
Expand Down Expand Up @@ -74,8 +74,8 @@ extension CarouselStack {
index = newIndex
direction = .left
notifyListener(context: context)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.005) {
withAnimation(animation.timing(duration: duration(0.1))) {
DispatchQueue.main.asyncAfter(deadline: .now() + (autoSliding ? 0 : 0.005)) {
withAnimation(animation.timing(duration: duration(0.12))) {
xPosition = 0
autoSliding = false
}
Expand Down

0 comments on commit b1b963c

Please sign in to comment.