@@ -59,24 +59,34 @@ export class PrimitiveTool {
5959 drawBrushPath ( ) {
6060 const smPoints = this . points ;
6161
62- this . ctx . beginPath ( ) ;
63- this . ctx . lineWidth = this . lineWidth ;
64- this . ctx . strokeStyle = this . main . colorWidgetState . line . alphaColor ;
65- this . ctx . fillStyle = this . main . colorWidgetState . fill . alphaColor ;
66-
67- this . ctx . moveTo ( this . points [ 0 ] . x , this . points [ 0 ] . y ) ;
68- let last ;
69- for ( let p of smPoints . slice ( 1 ) ) {
70- this . ctx . lineTo ( p . x , p . y ) ;
71- last = p ;
72- }
73- if ( last ) {
74- this . ctx . moveTo ( last . x , last . y ) ;
62+ if ( smPoints . length === 1 ) {
63+ this . ctx . beginPath ( ) ;
64+ this . ctx . lineWidth = 0 ;
65+ this . ctx . fillStyle = this . main . colorWidgetState . line . alphaColor ;
66+ this . ctx . ellipse (
67+ this . points [ 0 ] . x , this . points [ 0 ] . y ,
68+ this . lineWidth / 2 , this . lineWidth / 2 ,
69+ 0 , 2 * Math . PI , false ) ;
70+ this . ctx . fill ( ) ;
71+ this . ctx . closePath ( ) ;
72+ } else {
73+ this . ctx . beginPath ( ) ;
74+ this . ctx . lineWidth = this . lineWidth ;
75+ this . ctx . strokeStyle = this . main . colorWidgetState . line . alphaColor ;
76+ this . ctx . fillStyle = this . main . colorWidgetState . fill . alphaColor ;
77+
78+ this . ctx . moveTo ( this . points [ 0 ] . x , this . points [ 0 ] . y ) ;
79+ let last ;
80+ for ( let p of smPoints . slice ( 1 ) ) {
81+ this . ctx . lineTo ( p . x , p . y ) ;
82+ last = p ;
83+ }
84+ if ( last ) {
85+ this . ctx . moveTo ( last . x , last . y ) ;
86+ }
87+ this . ctx . stroke ( ) ;
88+ this . ctx . closePath ( ) ;
7589 }
76-
77- this . ctx . stroke ( ) ;
78-
79- this . ctx . closePath ( ) ;
8090 }
8191
8292 handleMouseMove ( event ) {
0 commit comments