@@ -88,7 +88,8 @@ class BrushTool extends paper.Tool {
8888 this . lastSize = this . size ;
8989 this . lastColor = this . color ;
9090 }
91- constrainPoint ( delta , lastPoint , modifiers ) {
91+ constrainPoint ( currentPoint , lastPoint , modifiers ) {
92+ let delta = currentPoint . subtract ( lastPoint ) ;
9293 if ( modifiers . shift ) {
9394 // 45 degree movement
9495 delta = snapDeltaToAngle ( delta , Math . PI / 4 ) ;
@@ -129,21 +130,21 @@ class BrushTool extends paper.Tool {
129130 }
130131 }
131132
132- const point = this . constrainPoint ( event . delta , event . point , event . modifiers ) ;
133+ const point = event . point ;
133134 this . drawNextLine ( point , point ) ;
134135 this . lastPoint = point ;
135136 }
136137 handleMouseDrag ( event ) {
137138 if ( event . event . button > 0 || ! this . active ) return ; // only first mouse button
138139
139- const point = this . constrainPoint ( event . delta , event . point , event . modifiers ) ;
140+ const point = this . constrainPoint ( event . point , this . lastPoint , event . modifiers ) ;
140141 this . drawNextLine ( this . lastPoint , point ) ;
141142 this . lastPoint = point ;
142143 }
143144 handleMouseUp ( event ) {
144145 if ( event . event . button > 0 || ! this . active ) return ; // only first mouse button
145146
146- const point = this . constrainPoint ( event . delta , event . point , event . modifiers ) ;
147+ const point = this . constrainPoint ( event . point , this . lastPoint , event . modifiers ) ;
147148 this . drawNextLine ( this . lastPoint , point ) ;
148149 if ( ! this . isEraser ) {
149150 getRaster ( ) . drawImage ( this . drawTarget . canvas , new paper . Point ( 0 , 0 ) ) ;
0 commit comments