@@ -823,21 +823,10 @@ import {
823
823
typeof this . path [ i + 1 ] . x === "number"
824
824
) {
825
825
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
- } ) ;
831
826
break ;
832
827
}
833
828
}
834
829
}
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
- }
841
830
this . path . push ( {
842
831
type : "close"
843
832
} ) ;
@@ -995,9 +984,6 @@ import {
995
984
}
996
985
counterclockwise = Boolean ( counterclockwise ) ;
997
986
998
- var x_start = x + radius * Math . cos ( startAngle ) ;
999
- var y_start = y + radius * Math . sin ( startAngle ) ;
1000
-
1001
987
if ( ! this . ctx . transform . isIdentity ) {
1002
988
var xpt = this . ctx . transform . applyToPoint ( new Point ( x , y ) ) ;
1003
989
x = xpt . x ;
@@ -1014,7 +1000,6 @@ import {
1014
1000
startAngle = 0 ;
1015
1001
endAngle = 2 * Math . PI ;
1016
1002
}
1017
- this . lineTo ( x_start , y_start ) ;
1018
1003
1019
1004
this . path . push ( {
1020
1005
type : "arc" ,
@@ -2096,6 +2081,7 @@ import {
2096
2081
style = null ;
2097
2082
}
2098
2083
2084
+ var began = false ;
2099
2085
for ( var k = 0 ; k < moves . length ; k ++ ) {
2100
2086
if ( moves [ k ] . arc ) {
2101
2087
var arcs = moves [ k ] . abs ;
@@ -2113,21 +2099,22 @@ import {
2113
2099
arc . endAngle ,
2114
2100
arc . counterclockwise ,
2115
2101
undefined ,
2116
- isClip
2102
+ isClip ,
2103
+ ! began
2117
2104
) ;
2118
2105
} else {
2119
2106
drawLine . call ( this , arc . x , arc . y ) ;
2120
2107
}
2108
+ began = true ;
2121
2109
}
2122
- putStyle . call ( this , style ) ;
2110
+ } else if ( moves [ k ] . close === true ) {
2123
2111
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 ;
2131
2118
}
2132
2119
}
2133
2120
@@ -2205,15 +2192,28 @@ import {
2205
2192
* @param style
2206
2193
* @param isClip
2207
2194
*/
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
+ ) {
2209
2206
// http://hansmuller-flex.blogspot.com/2011/10/more-about-approximating-circular-arcs.html
2210
- var includeMove = true ;
2211
2207
var curves = createArc . call ( this , r , a1 , a2 , counterclockwise ) ;
2212
2208
2213
2209
for ( var i = 0 ; i < curves . length ; i ++ ) {
2214
2210
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
+ }
2217
2217
}
2218
2218
drawCurve . call (
2219
2219
this ,
0 commit comments