Skip to content

Commit

Permalink
Call scroll completion block when scroll cancelled in more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cbpowell committed Aug 7, 2021
1 parent 8349b2c commit 34dc794
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/MarqueeLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -806,12 +806,21 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
}

private func returnLabelToHome() {
// Store if label is away from home at time of call
let away = awayFromHome

// Remove any gradient animation
maskLayer?.removeAllAnimations()

// Remove all sublabel position animations
sublabel.layer.removeAllAnimations()

// Fire completion block if appropriate
if away {
// If label was away when this was called, animation did NOT finish
scrollCompletionBlock?(!away)
}

// Remove completion block
scrollCompletionBlock = nil
}
Expand Down

0 comments on commit 34dc794

Please sign in to comment.