From 1165323ea3365ec8787d6e9fb9711db73dc66c5f Mon Sep 17 00:00:00 2001 From: Anton Popkov Date: Mon, 10 Dec 2018 18:44:27 +0300 Subject: [PATCH] Slider thumb with shadow frame calculation fix --- TGPControls/TGPDiscreteSlider.swift | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/TGPControls/TGPDiscreteSlider.swift b/TGPControls/TGPDiscreteSlider.swift index 2936263..b38457a 100644 --- a/TGPControls/TGPDiscreteSlider.swift +++ b/TGPControls/TGPDiscreteSlider.swift @@ -464,19 +464,13 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER { let thumbSizeForStyle = thumbSizeIncludingShadow() let thumbWidth = thumbSizeForStyle.width let thumbHeight = thumbSizeForStyle.height - let rectangle = CGRect(x:thumbAbscissa - (thumbWidth / 2), - y: (frame.height - thumbHeight)/2, - width: thumbWidth, - height: thumbHeight) - let shadowRadius = (thumbComponentStyle == .iOS) ? iOSThumbShadowRadius : thumbShadowRadius let shadowOffset = (thumbComponentStyle == .iOS) ? iOSThumbShadowOffset : thumbShadowOffset - thumbLayer.frame = ((shadowRadius != 0.0) // Ignore offset if there is no shadow - ? rectangle.insetBy(dx: shadowRadius + shadowOffset.width, - dy: shadowRadius + shadowOffset.height) - : rectangle.insetBy(dx: shadowRadius, - dy: shadowRadius)) + thumbLayer.frame = CGRect(x:thumbAbscissa - (thumbWidth / 2), + y: (frame.height - thumbHeight)/2, + width: thumbWidth, + height: thumbHeight) switch thumbComponentStyle { case .rounded: // A rounded thumb is circular