Skip to content

Commit bdde19b

Browse files
committed
fix mouse pos detection in LGraphCanvas.drawButton
1 parent 16c294e commit bdde19b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/litegraph.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5806,7 +5806,7 @@ LGraphNode.prototype.executeAction = function(action)
58065806
this.mouse[1] = e.clientY;
58075807
this.graph_mouse[0] = e.canvasX;
58085808
this.graph_mouse[1] = e.canvasY;
5809-
this.last_click_position = [this.graph_mouse[0],this.graph_mouse[1]];
5809+
this.last_click_position = [this.mouse[0],this.mouse[1]];
58105810

58115811
if (this.pointer_is_down && is_primary ){
58125812
this.pointer_is_double = true;
@@ -8100,7 +8100,7 @@ LGraphNode.prototype.executeAction = function(action)
81008100
bgcolor = bgcolor || LiteGraph.NODE_DEFAULT_COLOR;
81018101
hovercolor = hovercolor || "#555";
81028102
textcolor = textcolor || LiteGraph.NODE_TEXT_COLOR;
8103-
var pos = this.graph_mouse;
8103+
var pos = this.ds.convertOffsetToCanvas(this.graph_mouse);
81048104
var hover = LiteGraph.isInsideRectangle( pos[0], pos[1], x,y,w,h );
81058105
pos = this.last_click_position;
81068106
var clicked = pos && LiteGraph.isInsideRectangle( pos[0], pos[1], x,y,w,h );

0 commit comments

Comments
 (0)