Merge branch 'bugfix/badgeIndicator' into 'develop'
Bugfixes for BadgeIndicator See merge request BPHV_MIPS/vds_ios!195
This commit is contained in:
commit
c42fe4ecdf
@ -87,47 +87,38 @@ open class BadgeIndicator: View {
|
||||
var font: Font = .edsRegular
|
||||
var pointSize: CGFloat = VDSTypography.fontSizeBody12
|
||||
var letterSpacing: CGFloat = 0.0
|
||||
var lineHeight: CGFloat = 0.0
|
||||
var edgeInsets: UIEdgeInsets = .zero
|
||||
|
||||
switch self {
|
||||
case .xxlarge:
|
||||
pointSize = VDSTypography.fontSizeTitle24
|
||||
lineHeight = VDSTypography.lineHeightTitle24
|
||||
|
||||
case .xlarge:
|
||||
pointSize = VDSTypography.fontSizeTitle20
|
||||
lineHeight = VDSTypography.lineHeightTitle20
|
||||
|
||||
case .large:
|
||||
pointSize = VDSTypography.fontSizeBody16
|
||||
letterSpacing = VDSTypography.letterSpacingWide
|
||||
lineHeight = VDSTypography.lineHeightBody16
|
||||
|
||||
case .medium:
|
||||
pointSize = VDSTypography.fontSizeBody14
|
||||
letterSpacing = VDSTypography.letterSpacingWide
|
||||
lineHeight = 14.0
|
||||
|
||||
case .small:
|
||||
font = .etxRegular
|
||||
pointSize = VDSTypography.fontSizeBody12
|
||||
lineHeight = 12.0
|
||||
|
||||
}
|
||||
|
||||
return TextStyle(rawValue: "\(self.rawValue)BadgeIndicator",
|
||||
fontFace: font,
|
||||
pointSize: pointSize,
|
||||
lineHeight: lineHeight,
|
||||
letterSpacing: letterSpacing,
|
||||
edgeInsets: edgeInsets)
|
||||
lineHeight: 0,
|
||||
letterSpacing: letterSpacing)
|
||||
}
|
||||
|
||||
//EdgeInsets for the label.
|
||||
public var edgeInset: UIEdgeInsets {
|
||||
var horizontalPadding: CGFloat = 0.0
|
||||
let verticalPadding: CGFloat = 2.0
|
||||
let verticalPadding: CGFloat = 0.0
|
||||
|
||||
switch self {
|
||||
case .xxlarge:
|
||||
@ -376,10 +367,9 @@ open class BadgeIndicator: View {
|
||||
|
||||
//border
|
||||
if hideBorder {
|
||||
layer.borderWidth = 0
|
||||
removeBezierPathBorder()
|
||||
} else {
|
||||
layer.borderWidth = borderWidth
|
||||
layer.borderColor = borderColorConfiguration.getColor(surface).cgColor
|
||||
bezierPathBorder(borderColorConfiguration.getColor(surface), width: borderWidth)
|
||||
}
|
||||
|
||||
//dot
|
||||
@ -464,5 +454,4 @@ open class BadgeIndicator: View {
|
||||
let maxNumber = Int(pow(10.0, Double(maxDigits))) - 1
|
||||
return min(number, maxNumber)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -148,3 +148,44 @@ extension UIView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension UIView {
|
||||
|
||||
fileprivate var bezierPathIdentifier: String { return "bezierPathBorderLayer" }
|
||||
|
||||
fileprivate var bezierPathBorder: CAShapeLayer? {
|
||||
return (self.layer.sublayers?.filter({ (layer) -> Bool in
|
||||
return layer.name == self.bezierPathIdentifier && (layer as? CAShapeLayer) != nil
|
||||
}) as? [CAShapeLayer])?.first
|
||||
}
|
||||
|
||||
public func bezierPathBorder(_ color: UIColor = .white, width: CGFloat = 1) {
|
||||
|
||||
var border = self.bezierPathBorder
|
||||
let path = UIBezierPath(roundedRect: self.bounds, cornerRadius:self.layer.cornerRadius)
|
||||
let mask = CAShapeLayer()
|
||||
mask.path = path.cgPath
|
||||
self.layer.mask = mask
|
||||
|
||||
if (border == nil) {
|
||||
border = CAShapeLayer()
|
||||
border!.name = self.bezierPathIdentifier
|
||||
self.layer.addSublayer(border!)
|
||||
}
|
||||
|
||||
border!.frame = self.bounds
|
||||
let pathUsingCorrectInsetIfAny =
|
||||
UIBezierPath(roundedRect: border!.bounds, cornerRadius:self.layer.cornerRadius)
|
||||
|
||||
border!.path = pathUsingCorrectInsetIfAny.cgPath
|
||||
border!.fillColor = UIColor.clear.cgColor
|
||||
border!.strokeColor = color.cgColor
|
||||
border!.lineWidth = width * 2
|
||||
}
|
||||
|
||||
public func removeBezierPathBorder() {
|
||||
self.layer.mask = nil
|
||||
self.bezierPathBorder?.removeFromSuperlayer()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
1.0.57
|
||||
----------------
|
||||
- CXTDT-540077 - BadgeIndicator Font
|
||||
- CXTDT-540084 - BadgeIndicator Border
|
||||
|
||||
1.0.56
|
||||
----------------
|
||||
- ONEAPP-7190 - Breadcrumbs - Finished Development
|
||||
|
||||
Loading…
Reference in New Issue
Block a user