@@ -11,7 +11,9 @@ import AppKit
1111open class LineFragmentView : NSView {
1212 public weak var lineFragment : LineFragment ?
1313 public weak var renderer : LineFragmentRenderer ?
14+ #if DEBUG_LINE_INVALIDATION
1415 private var backgroundAnimation : CABasicAnimation ?
16+ #endif
1517
1618 open override var isFlipped : Bool {
1719 true
@@ -26,14 +28,13 @@ open class LineFragmentView: NSView {
2628 /// Initialize with random background color animation
2729 public override init ( frame frameRect: NSRect ) {
2830 super. init ( frame: frameRect)
29- setupBackgroundAnimation ( )
3031 }
3132
3233 required public init ? ( coder: NSCoder ) {
3334 super. init ( coder: coder)
34- setupBackgroundAnimation ( )
3535 }
3636
37+ #if DEBUG_LINE_INVALIDATION
3738 /// Setup background animation from random color to clear
3839 private func setupBackgroundAnimation( ) {
3940 // Ensure the view is layer-backed for animation
@@ -67,14 +68,16 @@ open class LineFragmentView: NSView {
6768 self . layer? . backgroundColor = NSColor . clear. cgColor
6869 }
6970 }
71+ #endif
7072
7173 /// Prepare the view for reuse, clears the line fragment reference and restarts animation.
7274 open override func prepareForReuse( ) {
7375 super. prepareForReuse ( )
7476 lineFragment = nil
7577
76- // Restart the background animation
78+ #if DEBUG_LINE_INVALIDATION
7779 setupBackgroundAnimation ( )
80+ #endif
7881 }
7982
8083 /// Set a new line fragment for this view, updating view size.
0 commit comments