TGPDiscreteSlider fix track with image size
This commit is contained in:
parent
cec613690e
commit
918edbd74f
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue