         }
         return trackImage!.size.height
     }
+}
+
+extension SDSlider {
     
     private func updateMinTrackView() {
         minTrackView.image = minTrackImage

                self.value = Double(1 - s) * (maxValue - minValue) + minValue
            }
        }
        self.sendActions(for: .valueChanged)
    }
    
    public override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
        
        self.sendActions(for: .touchDown)
        
        let location = touch.location(in: self)
        
        let minSize = Swift.min(bounds.width, bounds.height)
        let hitTestMinSize = CGSize(width: minSize, height: minSize)
        
        let thumbViewHitBox = thumbView.frame.union(CGRect(origin: thumbView.frame.origin, size: hitTestMinSize))
        let thumbViewHitBoxCenterOffsetX = thumbView.frame.midX - thumbViewHitBox.midX
        let thumbViewHitBoxCenterOffsetY = thumbView.frame.midY - thumbViewHitBox.midY
        
        if thumbViewHitBox.offsetBy(dx: thumbViewHitBoxCenterOffsetX, dy: thumbViewHitBoxCenterOffsetY).contains(location) {
            thumbView.isHighlighted = true
            locateAndUpdateValue(location: location)
        } else if trackTouchRespond {
            let trackViewHitBox = trackView.frame.union(CGRect(origin: trackView.frame.origin, size: hitTestMinSize))
            let trackViewHitBoxCenterOffsetX = trackView.frame.midX - trackViewHitBox.midX
            let trackViewHitBoxCenterOffsetY = trackView.frame.midY - trackViewHitBox.midY
            if trackViewHitBox.offsetBy(dx: trackViewHitBoxCenterOffsetX, dy: trackViewHitBoxCenterOffsetY).contains(location) {
                thumbView.isHighlighted = true
                locateAndUpdateValue(location: location)
            }
        }
        
        return thumbView.isHighlighted
    }
    public override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
        locateAndUpdateValue(location: touch.location(in: self))
        return true
    }
    public override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
        if let touch = touch {
            locateAndUpdateValue(location: touch.location(in: self))
        }
        thumbView.isHighlighted = false
    }
}

            }
        }
    }
}

extension SDSlider {
    
    @objc func handleTapGesture(_ sender: UITapGestureRecognizer) {
        
        self.sendActions(for: .touchDown)
        self.set_location(sender.location(in: self))
    }
    
    @objc func handlePanGesture(_ sender: UIPanGestureRecognizer) {
        
        if sender.state == .began {
            self.sendActions(for: .touchDown)
            thumbView.isHighlighted = true
        }
        
        self.set_location(sender.location(in: self))
        
        if sender.state != .began || sender.state != .changed {
            thumbView.isHighlighted = false
        }
    }
    
    private func set_location(_ location: CGPoint) {
        
        if isHorizontal {
            if minTrackImage == nil && maxTrackImage == nil {
                let s = (location.x - 0.5 * thumbWidth) / (trackWidth - thumbWidth)
