Skip to content

Commit

Permalink
Fix zoom (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Jul 5, 2024
1 parent 1933526 commit ce7d0a6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/litegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -7581,9 +7581,14 @@ LGraphNode.prototype.executeAction = function(action)
clientX_rel = e.clientX;
clientY_rel = e.clientY;
}

e.deltaX = clientX_rel - this.last_mouse_position[0];
e.deltaY = clientY_rel- this.last_mouse_position[1];

// Only set deltaX and deltaY if not already set.
// If deltaX and deltaY are already present, they are read-only.
// Setting them would result browser error => zoom in/out feature broken.
if (e.deltaX === undefined)
e.deltaX = clientX_rel - this.last_mouse_position[0];
if (e.deltaY === undefined)
e.deltaY = clientY_rel- this.last_mouse_position[1];

this.last_mouse_position[0] = clientX_rel;
this.last_mouse_position[1] = clientY_rel;
Expand Down

0 comments on commit ce7d0a6

Please sign in to comment.