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