avoid negative value
This commit is contained in:
parent
13cc6bf209
commit
fffb04e5e1
@ -176,7 +176,7 @@ open class DoughnutChart: View {
|
||||
labelContainer.layoutIfNeeded()
|
||||
let radius = sizeObject.getValueBasedOnApplicationWidth()/2 - lineWidth()
|
||||
let labelheight = labelContainer.frame.height/2
|
||||
let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(abs(pow(radius, 2) - pow(labelheight, 2)))
|
||||
let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(max(0, pow(radius, 2) - pow(labelheight, 2)))
|
||||
|
||||
labelContainerLeftConstraint?.constant = padding
|
||||
labelContainerRightConstraint?.constant = padding
|
||||
|
||||
Loading…
Reference in New Issue
Block a user