Changeset 387
- Timestamp:
- 11/23/07 17:54:27 (14 months ago)
- Files:
-
- 1 modified
-
veekun/trunk/lib/Vee/Utils/SVG.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
veekun/trunk/lib/Vee/Utils/SVG.pm
r383 r387 126 126 127 127 $angle += $ratio * 2 * PI; 128 $angle /=2 if ($ratio == 1); #if angle is 360, make it 180 (see hack below) 128 129 my $to_x = sprintf '%.3f', $center_x + $pie_radius * cos $angle; 129 130 my $to_y = sprintf '%.3f', $center_y + $pie_radius * sin $angle; … … 134 135 $svg .= qq[ <path d="]; 135 136 $svg .= qq[ M$last_x $last_y ]; 136 $svg .= qq[ A$pie_radius $pie_radius 0 @{[ $ratio > 0.5 ? 1 : 0 ]} 1 $to_x $to_y ]; 137 # kind of hacky: if the angle is 360, draw 180 degrees of the circle, then draw the other 180 degrees 138 # breaks in firefox otherwise 139 if ($ratio == 1) { 140 $svg .= qq[ A$pie_radius $pie_radius 0 1,1 $to_x $to_y ]; 141 $svg .= qq[ A$pie_radius $pie_radius 0 1,1 $last_x $last_y ]; 142 } else { 143 $svg .= qq[ A$pie_radius $pie_radius 0 @{[ $ratio > 0.5 ? 1 : 0 ]},1 $to_x $to_y ]; 144 } 137 145 $svg .= qq[ L$center_x $center_y ] unless ($ratio == 0 || $ratio == 1); 138 146 $svg .= qq[ Z ]; … … 230 238 231 239 $angle += $ratio * 2 * PI; 240 $angle /=2 if ($ratio == 1); #if angle is 360, make it 180 (see hack below) 232 241 my $to_x = sprintf '%.3f', $center_x + $pie_radius * cos $angle; 233 242 my $to_y = sprintf '%.3f', $center_y + $pie_radius * sin $angle; … … 237 246 $svg .= qq[ <path d="]; 238 247 $svg .= qq[ M$last_x $last_y ]; 239 $svg .= qq[ A$pie_radius $pie_radius 0 @{[ $ratio > 0.5 ? 1 : 0 ]} 1 $to_x $to_y ]; 248 # kind of hacky: if the angle is 360, draw 180 degrees of the circle, then draw the other 180 degrees 249 # breaks in firefox otherwise 250 if ($ratio == 1) { 251 $svg .= qq[ A$pie_radius $pie_radius 0 1,1 $to_x $to_y ]; 252 $svg .= qq[ A$pie_radius $pie_radius 0 1,1 $last_x $last_y ]; 253 } else { 254 $svg .= qq[ A$pie_radius $pie_radius 0 @{[ $ratio > 0.5 ? 1 : 0 ]},1 $to_x $to_y ]; 255 } 240 256 $svg .= qq[ L$center_x $center_y ]; 241 257 $svg .= qq[ Z ];
