init method

dynamic init(
  1. Size size
)

初始化

Implementation

init(Size size) {
  startX = basePadding;
  endX = size.width - basePadding;
  startY = size.height - basePadding;
  endY = basePadding;

  centerX = startX + (endX - startX) / 2;
  centerY = endY + (startY - endY) / 2;
  double xR = endX - centerX;
  double yR = startY - centerY;
  double realR = xR.compareTo(yR) > 0 ? yR : xR;

  if (R == null || R == 0) {
    R = realR;
  } else {
    if (R! > realR) R = realR;
  }
  if (centerR! > R!) centerR = R;

  setPieAngle(); //计算角度
}