Skip to content

Commit 676bb36

Browse files
committed
Refactor LGraphCanvas drawButton click logic
1 parent bdde19b commit 676bb36

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/litegraph.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8103,6 +8103,11 @@ LGraphNode.prototype.executeAction = function(action)
81038103
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;
8106+
if(pos) {
8107+
var rect = this.canvas.getBoundingClientRect();
8108+
pos[0] -= rect.left;
8109+
pos[1] -= rect.top;
8110+
}
81068111
var clicked = pos && LiteGraph.isInsideRectangle( pos[0], pos[1], x,y,w,h );
81078112

81088113
ctx.fillStyle = hover ? hovercolor : bgcolor;

0 commit comments

Comments
 (0)