Kaynağa Gözat

Prevent drawCircle from drawing a triangle (#326)

Nacho Verdón 7 yıl önce
ebeveyn
işleme
1e59ddc7e4
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      h2d/Graphics.hx

+ 1 - 1
h2d/Graphics.hx

@@ -422,7 +422,7 @@ class Graphics extends Drawable {
 	public function drawCircle( cx : Float, cy : Float, ray : Float, nsegments = 0 ) {
 	public function drawCircle( cx : Float, cy : Float, ray : Float, nsegments = 0 ) {
 		flush();
 		flush();
 		if( nsegments == 0 )
 		if( nsegments == 0 )
-			nsegments = Math.ceil(ray * 3.14 * 2 / 4);
+			nsegments = Math.ceil(Math.abs(ray * 3.14 * 2 / 4));
 		if( nsegments < 3 ) nsegments = 3;
 		if( nsegments < 3 ) nsegments = 3;
 		var angle = Math.PI * 2 / nsegments;
 		var angle = Math.PI * 2 / nsegments;
 		for( i in 0...nsegments + 1 ) {
 		for( i in 0...nsegments + 1 ) {