@@ -672,9 +672,10 @@ class Renderer2D extends Renderer {
672672 const tempPath = new Path2D ( ) ;
673673 tempPath . ellipse ( centerX , centerY , radiusX , radiusY , 0 , start , stop ) ;
674674 const currentTransform = this . drawingContext . getTransform ( ) ;
675- const ClipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
676- const relativeTransform = ClipBaseTransform . multiply ( currentTransform ) ;
675+ const clipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
676+ const relativeTransform = clipBaseTransform . multiply ( currentTransform ) ;
677677 this . clipPath . addPath ( tempPath , relativeTransform ) ;
678+ return this ;
678679 }
679680 // Determines whether to add a line to the center, which should be done
680681 // when the mode is PIE or default; as well as when the start and end
@@ -687,16 +688,16 @@ class Renderer2D extends Renderer {
687688
688689 // Fill curves
689690 if ( this . states . fillColor ) {
690- if ( ! this . _clipping ) ctx . beginPath ( ) ;
691+ ctx . beginPath ( ) ;
691692 ctx . ellipse ( centerX , centerY , radiusX , radiusY , 0 , start , stop ) ;
692693 if ( createPieSlice ) ctx . lineTo ( centerX , centerY ) ;
693694 ctx . closePath ( ) ;
694- if ( ! this . _clipping ) ctx . fill ( ) ;
695+ ctx . fill ( ) ;
695696 }
696697
697698 // Stroke curves
698699 if ( this . states . strokeColor ) {
699- if ( ! this . _clipping ) ctx . beginPath ( ) ;
700+ ctx . beginPath ( ) ;
700701 ctx . ellipse ( centerX , centerY , radiusX , radiusY , 0 , start , stop ) ;
701702
702703 if ( mode === constants . PIE && createPieSlice ) {
@@ -709,8 +710,7 @@ class Renderer2D extends Renderer {
709710 // Stroke connects back to path begin for both PIE and CHORD
710711 ctx . closePath ( ) ;
711712 }
712-
713- if ( ! this . _clipping ) ctx . stroke ( ) ;
713+ ctx . stroke ( ) ;
714714 }
715715
716716 return this ;
@@ -742,9 +742,10 @@ class Renderer2D extends Renderer {
742742 const tempPath = new Path2D ( ) ;
743743 tempPath . ellipse ( centerX , centerY , radiusX , radiusY , 0 , 0 , 2 * Math . PI ) ;
744744 const currentTransform = this . drawingContext . getTransform ( ) ;
745- const ClipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
746- const relativeTransform = ClipBaseTransform . multiply ( currentTransform ) ;
745+ const clipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
746+ const relativeTransform = clipBaseTransform . multiply ( currentTransform ) ;
747747 this . clipPath . addPath ( tempPath , relativeTransform ) ;
748+ return this ;
748749 } else {
749750 ctx . beginPath ( ) ;
750751 ctx . ellipse ( centerX , centerY , radiusX , radiusY , 0 , 0 , 2 * Math . PI ) ;
@@ -772,15 +773,16 @@ class Renderer2D extends Renderer {
772773 tempPath . moveTo ( x1 , y1 ) ;
773774 tempPath . lineTo ( x2 , y2 ) ;
774775 const currentTransform = this . drawingContext . getTransform ( ) ;
775- const ClipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
776- const relativeTransform = ClipBaseTransform . multiply ( currentTransform ) ;
776+ const clipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
777+ const relativeTransform = clipBaseTransform . multiply ( currentTransform ) ;
777778 this . clipPath . addPath ( tempPath , relativeTransform ) ;
778779 return this ;
780+ } else {
781+ ctx . beginPath ( ) ;
782+ ctx . moveTo ( x1 , y1 ) ;
783+ ctx . lineTo ( x2 , y2 ) ;
784+ ctx . stroke ( ) ;
779785 }
780- if ( ! this . _clipping ) ctx . beginPath ( ) ;
781- ctx . moveTo ( x1 , y1 ) ;
782- ctx . lineTo ( x2 , y2 ) ;
783- if ( ! this . _clipping ) ctx . stroke ( ) ;
784786 return this ;
785787 }
786788
@@ -798,18 +800,14 @@ class Renderer2D extends Renderer {
798800 const drawingContextWidth = this . drawingContext . lineWidth ;
799801 tempPath . arc ( x , y , drawingContextWidth / 2 , 0 , constants . TWO_PI ) ;
800802 const currentTransform = this . drawingContext . getTransform ( ) ;
801- const ClipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
802- const relativeTransform = ClipBaseTransform . multiply ( currentTransform ) ;
803+ const clipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
804+ const relativeTransform = clipBaseTransform . multiply ( currentTransform ) ;
803805 this . clipPath . addPath ( tempPath , relativeTransform ) ;
804806 return this ;
805- }
806- if ( ! this . _clipping ) {
807- // swapping fill color to stroke and back after for correct point rendering
807+ } else {
808808 this . _setFill ( s ) ;
809- }
810- if ( ! this . _clipping ) ctx . beginPath ( ) ;
811- ctx . arc ( x , y , ctx . lineWidth / 2 , 0 , constants . TWO_PI , false ) ;
812- if ( ! this . _clipping ) {
809+ ctx . beginPath ( ) ;
810+ ctx . arc ( x , y , ctx . lineWidth / 2 , 0 , constants . TWO_PI , false ) ;
813811 ctx . fill ( ) ;
814812 this . _setFill ( f ) ;
815813 }
@@ -837,20 +835,21 @@ class Renderer2D extends Renderer {
837835 tempPath . lineTo ( x4 , y4 ) ;
838836 tempPath . closePath ( ) ;
839837 const currentTransform = this . drawingContext . getTransform ( ) ;
840- const ClipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
841- const relativeTransform = ClipBaseTransform . multiply ( currentTransform ) ;
838+ const clipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
839+ const relativeTransform = clipBaseTransform . multiply ( currentTransform ) ;
842840 this . clipPath . addPath ( tempPath , relativeTransform ) ;
841+ return this ;
843842 } else {
844843 ctx . beginPath ( ) ;
845844 ctx . moveTo ( x1 , y1 ) ;
846845 ctx . lineTo ( x2 , y2 ) ;
847846 ctx . lineTo ( x3 , y3 ) ;
848847 ctx . lineTo ( x4 , y4 ) ;
849848 ctx . closePath ( ) ;
850- if ( ! this . _clipping && doFill ) {
849+ if ( doFill ) {
851850 ctx . fill ( ) ;
852851 }
853- if ( ! this . _clipping && doStroke ) {
852+ if ( doStroke ) {
854853 ctx . stroke ( ) ;
855854 }
856855 }
@@ -886,13 +885,12 @@ class Renderer2D extends Renderer {
886885 tempPath . roundRect ( x , y , w , h , [ tl , tr , br , bl ] ) ;
887886 }
888887 const currentTransform = this . drawingContext . getTransform ( ) ;
889- const ClipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
890- const relativeTransform = ClipBaseTransform . multiply ( currentTransform ) ;
888+ const clipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
889+ const relativeTransform = clipBaseTransform . multiply ( currentTransform ) ;
891890 this . clipPath . addPath ( tempPath , relativeTransform ) ;
892891 return this ;
893892 }
894- if ( ! this . _clipping ) ctx . beginPath ( ) ;
895-
893+ ctx . beginPath ( ) ;
896894 if ( typeof tl === 'undefined' ) {
897895 // No rounded corners
898896 ctx . rect ( x , y , w , h ) ;
@@ -943,10 +941,10 @@ class Renderer2D extends Renderer {
943941
944942 ctx . roundRect ( x , y , w , h , [ tl , tr , br , bl ] ) ;
945943 }
946- if ( ! this . _clipping && this . states . fillColor ) {
944+ if ( doFill ) {
947945 ctx . fill ( ) ;
948946 }
949- if ( ! this . _clipping && this . states . strokeColor ) {
947+ if ( doStroke ) {
950948 ctx . stroke ( ) ;
951949 }
952950 return this ;
@@ -979,21 +977,22 @@ class Renderer2D extends Renderer {
979977 tempPath . lineTo ( x3 , y3 ) ;
980978 tempPath . closePath ( ) ;
981979 const currentTransform = this . drawingContext . getTransform ( ) ;
982- const ClipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
983- const relativeTransform = ClipBaseTransform . multiply ( currentTransform ) ;
980+ const clipBaseTransform = this . _clipBaseTransform . inverse ( ) ;
981+ const relativeTransform = clipBaseTransform . multiply ( currentTransform ) ;
984982 this . clipPath . addPath ( tempPath , relativeTransform ) ;
985983 return this ;
986- }
987- if ( ! this . _clipping ) ctx . beginPath ( ) ;
988- ctx . moveTo ( x1 , y1 ) ;
989- ctx . lineTo ( x2 , y2 ) ;
990- ctx . lineTo ( x3 , y3 ) ;
991- ctx . closePath ( ) ;
992- if ( ! this . _clipping && doFill ) {
993- ctx . fill ( ) ;
994- }
995- if ( ! this . _clipping && doStroke ) {
996- ctx . stroke ( ) ;
984+ } else {
985+ ctx . beginPath ( ) ;
986+ ctx . moveTo ( x1 , y1 ) ;
987+ ctx . lineTo ( x2 , y2 ) ;
988+ ctx . lineTo ( x3 , y3 ) ;
989+ ctx . closePath ( ) ;
990+ if ( doFill ) {
991+ ctx . fill ( ) ;
992+ }
993+ if ( doStroke ) {
994+ ctx . stroke ( ) ;
995+ }
997996 }
998997 return this ;
999998 }
0 commit comments