TGPDiscreteSlider fix track with image size

This commit is contained in:
Anton Popkov 2018-12-10 17:27:27 +03:00
parent cec613690e
commit 918edbd74f
1 changed files with 1 additions and 10 deletions

View File

@ -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,