@@ -823,21 +823,10 @@ import {
823823 typeof this . path [ i + 1 ] . x === "number"
824824 ) {
825825 pathBegin = new Point ( this . path [ i + 1 ] . x , this . path [ i + 1 ] . y ) ;
826- this . path . push ( {
827- type : "lt" ,
828- x : pathBegin . x ,
829- y : pathBegin . y
830- } ) ;
831826 break ;
832827 }
833828 }
834829 }
835- if (
836- typeof this . path [ i + 2 ] === "object" &&
837- typeof this . path [ i + 2 ] . x === "number"
838- ) {
839- this . path . push ( JSON . parse ( JSON . stringify ( this . path [ i + 2 ] ) ) ) ;
840- }
841830 this . path . push ( {
842831 type : "close"
843832 } ) ;
@@ -995,9 +984,6 @@ import {
995984 }
996985 counterclockwise = Boolean ( counterclockwise ) ;
997986
998- var x_start = x + radius * Math . cos ( startAngle ) ;
999- var y_start = y + radius * Math . sin ( startAngle ) ;
1000-
1001987 if ( ! this . ctx . transform . isIdentity ) {
1002988 var xpt = this . ctx . transform . applyToPoint ( new Point ( x , y ) ) ;
1003989 x = xpt . x ;
@@ -1014,7 +1000,6 @@ import {
10141000 startAngle = 0 ;
10151001 endAngle = 2 * Math . PI ;
10161002 }
1017- this . lineTo ( x_start , y_start ) ;
10181003
10191004 this . path . push ( {
10201005 type : "arc" ,
@@ -2096,6 +2081,7 @@ import {
20962081 style = null ;
20972082 }
20982083
2084+ var began = false ;
20992085 for ( var k = 0 ; k < moves . length ; k ++ ) {
21002086 if ( moves [ k ] . arc ) {
21012087 var arcs = moves [ k ] . abs ;
@@ -2113,21 +2099,22 @@ import {
21132099 arc . endAngle ,
21142100 arc . counterclockwise ,
21152101 undefined ,
2116- isClip
2102+ isClip ,
2103+ ! began
21172104 ) ;
21182105 } else {
21192106 drawLine . call ( this , arc . x , arc . y ) ;
21202107 }
2108+ began = true ;
21212109 }
2122- putStyle . call ( this , style ) ;
2110+ } else if ( moves [ k ] . close === true ) {
21232111 this . pdf . internal . out ( "h" ) ;
2124- }
2125- if ( ! moves [ k ] . arc ) {
2126- if ( moves [ k ] . close !== true && moves [ k ] . begin !== true ) {
2127- var x = moves [ k ] . start . x ;
2128- var y = moves [ k ] . start . y ;
2129- drawLines . call ( this , moves [ k ] . deltas , x , y ) ;
2130- }
2112+ began = false ;
2113+ } else if ( moves [ k ] . begin !== true ) {
2114+ var x = moves [ k ] . start . x ;
2115+ var y = moves [ k ] . start . y ;
2116+ drawLines . call ( this , moves [ k ] . deltas , x , y ) ;
2117+ began = true ;
21312118 }
21322119 }
21332120
@@ -2205,15 +2192,28 @@ import {
22052192 * @param style
22062193 * @param isClip
22072194 */
2208- var drawArc = function ( x , y , r , a1 , a2 , counterclockwise , style , isClip ) {
2195+ var drawArc = function (
2196+ x ,
2197+ y ,
2198+ r ,
2199+ a1 ,
2200+ a2 ,
2201+ counterclockwise ,
2202+ style ,
2203+ isClip ,
2204+ includeMove
2205+ ) {
22092206 // http://hansmuller-flex.blogspot.com/2011/10/more-about-approximating-circular-arcs.html
2210- var includeMove = true ;
22112207 var curves = createArc . call ( this , r , a1 , a2 , counterclockwise ) ;
22122208
22132209 for ( var i = 0 ; i < curves . length ; i ++ ) {
22142210 var curve = curves [ i ] ;
2215- if ( includeMove && i === 0 ) {
2216- doMove . call ( this , curve . x1 + x , curve . y1 + y ) ;
2211+ if ( i === 0 ) {
2212+ if ( includeMove ) {
2213+ doMove . call ( this , curve . x1 + x , curve . y1 + y ) ;
2214+ } else {
2215+ drawLine . call ( this , curve . x1 + x , curve . y1 + y ) ;
2216+ }
22172217 }
22182218 drawCurve . call (
22192219 this ,
0 commit comments