diff --git a/TGPControls/TGPDiscreteSlider.swift b/TGPControls/TGPDiscreteSlider.swift index a4dd013..2936263 100644 --- a/TGPControls/TGPDiscreteSlider.swift +++ b/TGPControls/TGPDiscreteSlider.swift @@ -424,11 +424,7 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER { if let image = trackImage, let cgImage = image.cgImage, let ctx = UIGraphicsGetCurrentContext() { - let centered = CGRect(x: (frame.width/2) - (image.size.width/2), - y: (frame.height/2) - (image.size.height/2), - width: image.size.width, - height: image.size.height) - ctx.draw(cgImage, in: centered) + ctx.draw(cgImage, in: trackRectangle) } case .rounded: @@ -558,11 +554,6 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER { let trackHeight = (.iOS == trackComponentStyle) ? 2 : trackThickness var trackSize = CGSize(width: frame.width - thumbWidth, height: trackHeight) - if(.image == trackComponentStyle) { - if let image = trackImage { - trackSize.width = image.size.width - thumbWidth - } - } trackRectangle = CGRect(x: (frame.width - trackSize.width)/2, y: (frame.height - trackSize.height)/2,