Skip to content

Commit 6a3e9a1

Browse files
committed
Call scroll completion block when scroll cancelled in more cases
1 parent 112d8b0 commit 6a3e9a1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/MarqueeLabel.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,12 +834,21 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
834834
}
835835

836836
private func returnLabelToHome() {
837+
// Store if label is away from home at time of call
838+
let away = awayFromHome
839+
837840
// Remove any gradient animation
838841
maskLayer?.removeAllAnimations()
839842

840843
// Remove all sublabel position animations
841844
sublabel.layer.removeAllAnimations()
842845

846+
// Fire completion block if appropriate
847+
if away {
848+
// If label was away when this was called, animation did NOT finish
849+
scrollCompletionBlock?(!away)
850+
}
851+
843852
// Remove completion block
844853
scrollCompletionBlock = nil
845854
}

0 commit comments

Comments
 (0)