@@ -92,7 +92,7 @@ class LGraphCanvas {
9292
9393 this . filter = null ; //allows to filter to only accept some type of nodes in a graph
9494
95- this . mouse = new DOMPoint ( 0 , 0 ) ; //mouse in canvas coordinates, where 0,0 is the top-left corner of the blue rectangle
95+ this . mouse = [ 0 , 0 ] ; //mouse in canvas coordinates, where 0,0 is the top-left corner of the blue rectangle
9696 this . graph_mouse = new DOMPoint ( 0 , 0 ) ; //mouse in graph coordinates, where 0,0 is the top-left corner of the blue rectangle
9797
9898 //to personalize the search box
@@ -593,7 +593,8 @@ class LGraphCanvas {
593593 var now = LiteGraph . getTime ( ) ;
594594 var is_primary = ( e . isPrimary === undefined || ! e . isPrimary ) ;
595595 var is_double_click = ( now - this . last_mouseclick < 300 ) && is_primary ;
596- this . mouse = clientPoint ;
596+ this . mouse [ 0 ] = e . clientX ;
597+ this . mouse [ 1 ] = e . clientY ;
597598 this . graph_mouse = canvasPoint ;
598599 this . last_click_position = clientPoint ;
599600
@@ -1017,13 +1018,14 @@ class LGraphCanvas {
10171018 }
10181019 LGraphCanvas . active_canvas = this ;
10191020 this . adjustMouseEvent ( e ) ;
1020- var mouse = new DOMPoint ( e . clientX , e . clientY ) ;
1021- this . mouse = mouse ;
1021+ var mouse = [ e . clientX , e . clientY ] ;
1022+ this . mouse [ 0 ] = mouse [ 0 ] ;
1023+ this . mouse [ 1 ] = mouse [ 1 ] ;
10221024 var delta = [
1023- mouse . x - this . last_mouse . x ,
1024- mouse . y - this . last_mouse . y
1025+ mouse [ 0 ] - this . last_mouse . x ,
1026+ mouse [ 1 ] - this . last_mouse . y
10251027 ] ;
1026- this . last_mouse = mouse ;
1028+ this . last_mouse = new DOMPoint ( mouse [ 0 ] , mouse [ 1 ] ) ;
10271029 this . graph_mouse = new DOMPoint ( e . canvasX , e . canvasY ) ;
10281030
10291031 //console.log("pointerevents: processMouseMove "+e.pointerId+" "+e.isPrimary);
@@ -2493,6 +2495,7 @@ class LGraphCanvas {
24932495 ctx . font = "14px Arial" ;
24942496 ctx . textAlign = "left" ;
24952497 ctx . fillText ( "Graph Inputs" , 20 , 34 ) ;
2498+ // var pos = this.mouse;
24962499
24972500 if ( this . drawButton ( w - 20 , 20 , 20 , 20 , "X" , "#151515" ) ) {
24982501 this . closeSubgraph ( ) ;
@@ -2565,6 +2568,7 @@ class LGraphCanvas {
25652568 var title_text = "Graph Outputs"
25662569 var tw = ctx . measureText ( title_text ) . width
25672570 ctx . fillText ( title_text , ( canvas_w - tw ) - 20 , 34 ) ;
2571+ // var pos = this.mouse;
25682572 if ( this . drawButton ( canvas_w - w , 20 , 20 , 20 , "X" , "#151515" ) ) {
25692573 this . closeSubgraph ( ) ;
25702574 return ;
@@ -2661,7 +2665,7 @@ class LGraphCanvas {
26612665 }
26622666
26632667 isAreaClicked ( x , y , w , h , hold_click ) {
2664- var pos = [ this . mouse . x , this . mouse . y ] ;
2668+ var pos = this . mouse ;
26652669 var hover = LiteGraph . isPointInsideRect ( new DOMPoint ( pos [ 0 ] , pos [ 1 ] ) , new DOMRect ( x , y , w , h ) ) ;
26662670 pos = [ this . last_click_position . left , this . last_click_position . top ] ;
26672671 var clicked = pos && LiteGraph . isPointInsideRect ( new DOMPoint ( pos [ 0 ] , pos [ 1 ] ) , new DOMRect ( x , y , w , h ) ) ;
0 commit comments