File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change 11class Network {
22 static PADDING = 50 ;
3+ static HIT_BOX = 40 ;
34
45 constructor ( canvasWidth , canvasHeight ) {
56 this . size = { w : canvasWidth , h : canvasHeight } ;
@@ -190,7 +191,7 @@ class Network {
190191 }
191192
192193 twoPointsTooClose ( p1 , p2 ) {
193- return p1 . distTo ( p2 ) < 40 ;
194+ return p1 . distTo ( p2 ) < Network . HIT_BOX ;
194195 }
195196
196197 createPoints ( ) {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ function mousePressed(event) {
2525 let mousePos = new Point ( mouseX , mouseY , - 1 ) ;
2626
2727 for ( let p of network . coordP ) {
28- if ( mousePos . distTo ( p ) <= 10 ) {
28+ if ( mousePos . distTo ( p ) <= Network . HIT_BOX >> 1 ) {
2929 if ( event . button === RIGHT_CLICK && network . start . index != p . index ) {
3030 network . end = p ;
3131 } else if ( network . end . index != p . index ) {
You can’t perform that action at this time.
0 commit comments