Skip to content

Commit

Permalink
Fix layer.masksToBounds
Browse files Browse the repository at this point in the history
Set `layer.masksToBounds` to true only if `indicatorViewInset` isn't negative to achieve the effect I mentioned in gmarm#75
  • Loading branch information
Idomo committed Oct 1, 2018
1 parent 5d84656 commit bababd2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Pod/Classes/BetterSegmentedControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ import Foundation
}
/// The indicator view's inset. Defaults to 2.0
@IBInspectable public var indicatorViewInset: CGFloat = 2.0 {
didSet { setNeedsLayout() }
didSet {
setNeedsLayout()
layer.masksToBounds = indicatorViewInset >= 0
}
}
/// The indicator view's border width
@IBInspectable public var indicatorViewBorderWidth: CGFloat {
Expand Down

0 comments on commit bababd2

Please sign in to comment.