update left and right padding

This commit is contained in:
Xinlei(Ryan) Pan 2020-01-15 13:28:40 -05:00
parent a318b19410
commit 9329f0ca15

View File

@ -174,8 +174,13 @@ open class DoughnutChart: View, MVMCoreUIViewConstrainingProtocol {
} }
func updateLabelContainer() { func updateLabelContainer() {
labelContainer.leftPin?.constant = lineWidth() labelContainer.layoutIfNeeded()
labelContainer.topPin?.constant = lineWidth() let radius = sizeObject.getValueBasedOnApplicationWidth()/2 - lineWidth()
let labelheight = labelContainer.frame.height/2
let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(pow(radius, 2) - pow(labelheight, 2))
labelContainer.leftPin?.constant = padding
labelContainer.topPin?.constant = padding
labelContainer.setNeedsDisplay() labelContainer.setNeedsDisplay()
} }