//
// © 2018-2020 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
//

import UIKit

class SpeakerSliderTableViewCellContentViewSlider: UISlider {

	private let trackHeight: CGFloat = 4.0
	
	override func awakeFromNib() {
		super.awakeFromNib()
		
        let tbImg = UIImage.image(color: ColorCompat.label, //UIColor(red: 44/255.0, green: 44/255.0, blue: 44/255.0, alpha: 1.0),
								  size: CGSize(width: 15, height: 15),
								  circular: true)
		
		setThumbImage(tbImg, for: .normal)
		setThumbImage(tbImg, for: .highlighted)
		setThumbImage(tbImg, for: .selected)

        minimumTrackTintColor = ColorCompat.label
        maximumTrackTintColor = ColorCompat.secondaryLabel
	}
	
	override func trackRect(forBounds bounds: CGRect) -> CGRect {
		let superRect = super.trackRect(forBounds: bounds)
		var customBounds = superRect
		
		// Make a bit wider.
		customBounds.origin.y -= round((trackHeight - superRect.size.height) / 2)
		customBounds.size.height = trackHeight
		return customBounds
	}
	
}
