Skip to content

Commit

Permalink
Merge pull request #114 from LiveYourProject/fix-animation-change
Browse files Browse the repository at this point in the history
Fix changing text without animation (allow enable/disable)
  • Loading branch information
lexrus authored Sep 27, 2018
2 parents befebe8 + 60bcdc4 commit 517a1a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion LTMorphingLabel/LTMorphingLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ typealias LTMorphingSkipFramesClosure =

fileprivate var displayLink: CADisplayLink?

private var tempRenderMorphingEnabled = true

#if TARGET_INTERFACE_BUILDER
let presentingInIB = true
#else
Expand Down Expand Up @@ -136,6 +138,7 @@ typealias LTMorphingSkipFramesClosure =
currentFrame = 0
totalFrames = 0

tempRenderMorphingEnabled = morphingEnabled
setNeedsLayout()

if !morphingEnabled {
Expand Down Expand Up @@ -489,7 +492,7 @@ extension LTMorphingLabel {
}

override open func drawText(in rect: CGRect) {
if !morphingEnabled || limboOfCharacters().count == 0 {
if !tempRenderMorphingEnabled || limboOfCharacters().count == 0 {
super.drawText(in: rect)
return
}
Expand Down

0 comments on commit 517a1a8

Please sign in to comment.