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

import UIKit

class NowPlayingVolumeSlider: UISlider {
    
    private let trackHeight: CGFloat = 4.0
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        setThumbImage(UIImage(named: "nowplaying-seekbar"), for: .normal)
        setThumbImage(UIImage(named: "nowplaying-seekbar-pressed"), for: .highlighted)
        setThumbImage(UIImage(named: "nowplaying-seekbar-pressed"), for: .selected)
        
    }
    
    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
    }
}
