@@ -540,7 +540,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
540
540
self . init ( frame: frame, duration: 7.0 , fadeLength: 0.0 )
541
541
}
542
542
543
- #if DEBUG
543
+ #if MARQUEELABEL_DEBUG
544
544
private var leadingView = UIView ( )
545
545
private var trailingView = UIView ( )
546
546
#endif
@@ -553,8 +553,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
553
553
// View Structure
554
554
self . addSubview ( sublabel)
555
555
556
- #if DEBUG
557
-
556
+ #if MARQUEELABEL_DEBUG
558
557
let labelMask = UIView ( )
559
558
labelMask. translatesAutoresizingMaskIntoConstraints = false
560
559
sublabel. addSubview ( labelMask)
@@ -686,7 +685,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
686
685
sublabel. adjustsFontSizeToFitWidth = super. adjustsFontSizeToFitWidth
687
686
sublabel. minimumScaleFactor = super. minimumScaleFactor
688
687
689
- #if DEBUG
688
+ #if MARQUEELABEL_DEBUG
690
689
trailingView. removeFromSuperview ( )
691
690
self . addSubview ( trailingView)
692
691
#endif
@@ -695,13 +694,13 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
695
694
switch type {
696
695
case . continuousReverse, . rightLeft:
697
696
labelFrame = bounds. divided ( atDistance: leadingBuffer, from: CGRectEdge . maxXEdge) . remainder. integral
698
- #if DEBUG
697
+ #if MARQUEELABEL_DEBUG
699
698
leadingView. frame = bounds. divided ( atDistance: leadingBuffer, from: CGRectEdge . maxXEdge) . slice. integral
700
699
trailingView. frame = bounds. divided ( atDistance: trailingBuffer, from: CGRectEdge . minXEdge) . slice. integral
701
700
#endif
702
701
default :
703
702
labelFrame = CGRect ( x: leadingBuffer, y: 0.0 , width: bounds. size. width - leadingBuffer, height: bounds. size. height) . integral
704
- #if DEBUG
703
+ #if MARQUEELABEL_DEBUG
705
704
leadingView. frame = CGRect ( x: 0.0 , y: 0.0 , width: leadingBuffer, height: bounds. size. height) . integral
706
705
trailingView. frame = bounds. divided ( atDistance: trailingBuffer, from: CGRectEdge . maxXEdge) . slice. integral
707
706
#endif
@@ -736,21 +735,21 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
736
735
737
736
switch type {
738
737
case . continuous, . continuousReverse:
739
- #if DEBUG
738
+ #if MARQUEELABEL_DEBUG
740
739
trailingView. removeFromSuperview ( )
741
740
sublabel. addSubview ( trailingView)
742
741
#endif
743
742
if type == . continuous {
744
743
homeLabelFrame = CGRect ( x: leadingBuffer, y: 0.0 , width: expectedLabelSize. width, height: bounds. size. height) . integral
745
744
awayOffset = - ( homeLabelFrame. size. width + minTrailing)
746
- #if DEBUG
745
+ #if MARQUEELABEL_DEBUG
747
746
leadingView. frame = CGRect ( x: 0.0 , y: 0.0 , width: leadingBuffer, height: bounds. size. height)
748
747
trailingView. frame = CGRect ( x: - awayOffset - minTrailing, y: 0.0 , width: trailingBuffer, height: bounds. size. height)
749
748
#endif
750
749
} else { // .ContinuousReverse
751
750
homeLabelFrame = CGRect ( x: bounds. size. width - ( expectedLabelSize. width + leadingBuffer) , y: 0.0 , width: expectedLabelSize. width, height: bounds. size. height) . integral
752
751
awayOffset = ( homeLabelFrame. size. width + minTrailing)
753
- #if DEBUG
752
+ #if MARQUEELABEL_DEBUG
754
753
leadingView. frame = bounds. divided ( atDistance: leadingBuffer, from: CGRectEdge . maxXEdge) . slice. integral
755
754
trailingView. frame = CGRect ( x: - trailingBuffer, y: 0.0 , width: trailingBuffer, height: bounds. size. height)
756
755
#endif
@@ -785,7 +784,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
785
784
repliLayer? . instanceTransform = CATransform3DMakeTranslation ( - awayOffset, 0.0 , 0.0 )
786
785
787
786
case . leftRight, . left, . rightLeft, . right:
788
- #if DEBUG
787
+ #if MARQUEELABEL_DEBUG
789
788
trailingView. removeFromSuperview ( )
790
789
self . addSubview ( trailingView)
791
790
#endif
@@ -794,7 +793,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
794
793
awayOffset = bounds. size. width - ( expectedLabelSize. width + leadingBuffer + trailingBuffer)
795
794
// Enforce text alignment for this type
796
795
sublabel. textAlignment = NSTextAlignment . left
797
- #if DEBUG
796
+ #if MARQUEELABEL_DEBUG
798
797
leadingView. frame = CGRect ( x: 0.0 , y: 0.0 , width: leadingBuffer, height: bounds. size. height)
799
798
trailingView. frame = bounds. divided ( atDistance: trailingBuffer, from: CGRectEdge . maxXEdge) . slice. integral
800
799
#endif
@@ -803,7 +802,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
803
802
awayOffset = ( expectedLabelSize. width + trailingBuffer + leadingBuffer) - bounds. size. width
804
803
// Enforce text alignment for this type
805
804
sublabel. textAlignment = NSTextAlignment . right
806
- #if DEBUG
805
+ #if MARQUEELABEL_DEBUG
807
806
leadingView. frame = bounds. divided ( atDistance: leadingBuffer, from: CGRectEdge . maxXEdge) . slice. integral
808
807
trailingView. frame = CGRect ( x: 0.0 , y: 0.0 , width: trailingBuffer, height: bounds. height)
809
808
#endif
0 commit comments