11import paper from '@scratch/paper' ;
2- import { stylePath } from '../style-path' ;
2+ import { styleShape } from '../style-path' ;
33import { endPointHit , touching } from '../snapping' ;
44import { drawHitPoint , removeHitPoint } from '../guides' ;
55
@@ -57,12 +57,17 @@ class PenTool extends paper.Tool {
5757 handleMouseDown ( event ) {
5858 if ( event . event . button > 0 ) return ; // only first mouse button
5959 this . subpath = new paper . Path ( { insert : false } ) ;
60+ this . subpath . strokeCap = 'round' ;
6061
6162 // If you click near a point, continue that line instead of making a new line
6263 this . hitResult = endPointHit ( event . point , PenTool . SNAP_TOLERANCE ) ;
6364 if ( this . hitResult ) {
6465 this . path = this . hitResult . path ;
65- stylePath ( this . path , this . colorState . strokeColor , this . colorState . strokeWidth ) ;
66+ styleShape ( this . path , {
67+ fillColor : null ,
68+ strokeColor : this . colorState . strokeColor ,
69+ strokeWidth : this . colorState . strokeWidth
70+ } ) ;
6671 if ( this . hitResult . isFirst ) {
6772 this . path . reverse ( ) ;
6873 }
@@ -74,7 +79,12 @@ class PenTool extends paper.Tool {
7479 // If not near other path, start a new path
7580 if ( ! this . path ) {
7681 this . path = new paper . Path ( ) ;
77- stylePath ( this . path , this . colorState . strokeColor , this . colorState . strokeWidth ) ;
82+ styleShape ( this . path , {
83+ fillColor : null ,
84+ strokeColor : this . colorState . strokeColor ,
85+ strokeWidth : this . colorState . strokeWidth
86+ } ) ;
87+ this . path . strokeCap = 'round' ;
7888 this . path . add ( event . point ) ;
7989 this . subpath . add ( event . point ) ;
8090 paper . view . draw ( ) ;
0 commit comments