     }
     private var trackWidth : CGFloat {
         if isHorizontal {
-            return bounds.width - (minImage?.size.width ?? 0) - (maxImage?.size.width ?? 0)
+            return bounds.width - (minTrackImage?.size.width ?? 0) - (maxTrackImage?.size.width ?? 0)
         }
         if trackImage == nil {
             return trackThickness

    
    private func locateAndUpdateValue(location: CGPoint) {
        if isHorizontal {
            if minImage == nil {
                let s = (location.x - trackCornerRadius) / (trackWidth - trackCornerRadius * 2.0)
                self.value = Double(s) * (maxValue - minValue) + minValue
            } else {
                let s = (location.x - minImage!.size.width) / trackWidth
                self.value = Double(s) * (maxValue - minValue) + minValue
            }
        } else {
            if minImage == nil {
                let s = (location.y - trackCornerRadius) / (trackHeight - trackCornerRadius * 2.0)
                self.value = Double(1 - s) * (maxValue - minValue) + minValue
            } else {
                let s = (location.y - minImage!.size.height) / trackHeight
                self.value = Double(1 - s) * (maxValue - minValue) + minValue
            }
        }

    @IBInspectable public var thumbCornerRadius: CGFloat = 0.0 {
        didSet {
            if thumbCornerRadius * 2.0 > thumbWidth || thumbCornerRadius * 2.0 > thumbHeight {
                thumbCornerRadius = 0.5 * min(thumbWidth, thumbHeight)
            }
            updateThumbView()
        }
