protected function Calc()
{
$bound_x_left = $this->pad_left;
$bound_y_top = $this->pad_top;
$bound_x_right = $this->width - $this->pad_right;
$bound_y_bottom = $this->height - $this->pad_bottom;
$w = $bound_x_right - $bound_x_left;
$h = $bound_y_bottom - $bound_y_top;
if ($this->aspect_ratio == 'auto') {
$this->aspect_ratio = $h / $w;
} elseif ($this->aspect_ratio <= 0) {
$this->aspect_ratio = 1.0;
}
$this->x_centre = ($bound_x_right - $bound_x_left) / 2 + $bound_x_left;
$this->y_centre = ($bound_y_bottom - $bound_y_top) / 2 + $bound_y_top;
$this->start_angle %= 360;
if ($this->start_angle < 0) {
$this->start_angle = 360 + $this->start_angle;
}
$this->s_angle = deg2rad($this->start_angle);
if ($h / $w > $this->aspect_ratio) {
$this->radius_x = $w / 2.0;
$this->radius_y = $this->radius_x * $this->aspect_ratio;
} else {
$this->radius_y = $h / 2.0;
$this->radius_x = $this->radius_y / $this->aspect_ratio;
}
$this->calc_done = true;
}
/** * Calculates reduced radius of pie */ protected function Calc() { parent::Calc(); $this->explode_amount = min($this->radius_x - 10, $this->radius_y - 10, max(2, (int) $this->explode_amount)); $this->radius_y -= $this->explode_amount; $this->radius_x -= $this->explode_amount; }