Skip to content

Commit bababd2

Browse files
authored
Fix layer.masksToBounds
Set `layer.masksToBounds` to true only if `indicatorViewInset` isn't negative to achieve the effect I mentioned in gmarm#75
1 parent 5d84656 commit bababd2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Pod/Classes/BetterSegmentedControl.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ import Foundation
130130
}
131131
/// The indicator view's inset. Defaults to 2.0
132132
@IBInspectable public var indicatorViewInset: CGFloat = 2.0 {
133-
didSet { setNeedsLayout() }
133+
didSet {
134+
setNeedsLayout()
135+
layer.masksToBounds = indicatorViewInset >= 0
136+
}
134137
}
135138
/// The indicator view's border width
136139
@IBInspectable public var indicatorViewBorderWidth: CGFloat {

0 commit comments

Comments
 (0)