         nsText.draw(in: trf.rect, withAttributes: [NSFontAttributeName : trf.font])
       }
     }
-  }
-  
-  fileprivate func drawTrackLine() {
-    trackLine.frame = trackRect
-    trackLine.cornerRadius = trackRect.height / 2.0
-    
-    maxLine.frame = {
-      var frame = trackLine.bounds
-      frame.size.width = thumbX - trackRect.minX
-      return frame
-    }()
-    
-    maxLine.backgroundColor = maximumTrackTintColor.cgColor
-    
-    minLine.frame = {
-      var frame = trackLine.bounds
-      frame.size.width = trackRect.width - maxLine.frame.width
-      frame.origin.x = maxLine.frame.maxX
-      return frame
-    }()
-    
-    minLine.backgroundColor = minimumTrackTintColor.cgColor
-  }
-  
-  var selectorSize : CGSize {
-    let dim = selectorRadius * 2.0 + shadowRadius * 2.0 + shadowOffset.width * 2
-    return CGSize(width: dim, height: dim)
-  }
-  
-  fileprivate func drawThumb() {
-      let dim = selectorSize.width
-      let rectangle = CGRect(x:thumbX, y: (frame.height - dim)/2, width: dim,
-        height: dim)
-      
-      var selectorFrame = rectangle.insetBy(dx: shadowRadius + shadowOffset.width,
-        dy: shadowRadius + shadowOffset.width)
-      
-      selectorFrame.origin.x = thumbX
-      
-      selector.frame = selectorFrame
-      
-      selector.backgroundColor = UIColor.white.cgColor
-      
-      let strokeColor = UIColor(red: 197.0 / 255.0, green: 197.0 / 255.0,
-        blue: 197.0 / 255.0, alpha: 1.0)
-      
-      selector.borderColor = strokeColor.cgColor
-      selector.borderWidth = 0.05
-      selector.cornerRadius = selector.frame.width / 2.0
-      selector.allowsEdgeAntialiasing = true
-      
-      // Shadow
-      selector.shadowOffset = shadowOffset
-      
-      selector.shadowRadius = shadowRadius
-      let shadowColor = UIColor(red: 197.0 / 255.0, green: 197.0 / 255.0,
-        blue: 197.0 / 255.0, alpha: 1.0)
-      selector.shadowColor = shadowColor.cgColor
-      selector.shadowOpacity = 1.0
-   }
-  
-  func moveThumbTo(x:CGFloat, animationDuration duration:TimeInterval,
-    discrete : Bool = false) {
-    
-    let leftMost = CGFloat(0.0)
-    let rightMost = frame.maxX
-    
-    let newDiscreteValue = showDiscretion(value: x)
-
-    thumbX = max(leftMost, min(x, rightMost))
-    
-    if newDiscreteValue != discreteValue {
-      discreteValue = newDiscreteValue
-    }
-    
-    if discrete {
-      assert(ballRects.count > newDiscreteValue)
-      let newThumbCenterX = ballRects[discreteValue].midX
-      thumbX = newThumbCenterX - selectorRadius
-    }
-   
-    
-    CATransaction.setAnimationDuration(duration)
-    
-    setNeedsDisplay()
   }
   
   fileprivate func paintText(text : String, textRectFont trf : TextRectFont, font: UIFont? = nil) {

    initPhase2()
  }
  
  required public init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    initPhase2()
  }
  
  fileprivate func initPhase2() {
    backgroundColor = .white
    layer.addSublayer(trackLine)
    trackLine.masksToBounds = true
    trackLine.backgroundColor = UIColor.clear.cgColor
    
    trackLine.addSublayer(maxLine)
    trackLine.addSublayer(minLine)
    maxLine.backgroundColor  = maximumTrackTintColor.cgColor
    minLine.backgroundColor = minimumTrackTintColor.cgColor
    layer.addSublayer(selector)
    
    isMultipleTouchEnabled = false
    layoutTrackLine()
    
    guard let font = getFont(bold: true) else {
      return
    }
    
    let nsString = NSString(string: "text String")
    let textSize = nsString.size(attributes: [NSFontAttributeName : font])
    textHeight = textSize.height
  }
  
  override public var intrinsicContentSize: CGSize {
    var height = selectorSize.height + (Constants.vertPad * 2)
    height += textHeight + Constants.vertPad
    
    guard let font = getFont(bold: true) else {
      return CGSize(width: 100.0, height: height)
    }
    

    var font : UIFont
  }
  
 
  fileprivate func getTextRectFontsAndCollisionInfo() -> ([TextRectFont], Bool, Bool) {
    var collision : Bool = false
    var endCollision : Bool = false
    var rectFonts : [TextRectFont] = []
    
    let ballRects = slider.ballRects
    let count = ballRects.count
    
    let sliderBottom = slider.frame.origin.y + slider.frame.height
    
    for i in 0..<count {
      let ballRect = ballRects[i]
      let text = values[i]
      let nsText = NSString(string: text)
      
      let bold = i == value
      guard let font = getAdaptiveFont(bold: bold) else {
        continue
      }
      
      let textSize = nsText.size(attributes: [NSFontAttributeName : font])
      
      var x : CGFloat = ballRect.center.x - textSize.width / 2
      if i == 0 {
        x = 0
      } else if i == ballRects.count - 1 {
