Skip to content

Commit

Permalink
Expose zoom speed option (#19)
Browse files Browse the repository at this point in the history
* Expose zoom speed option

* Avoid unnecessary operations
  • Loading branch information
christian-byrne authored Aug 21, 2024
1 parent 652fcb6 commit 86d9391
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/litegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -5180,6 +5180,7 @@ LGraphNode.prototype.executeAction = function(action)

this.ds = new DragAndScale();
this.zoom_modify_alpha = true; //otherwise it generates ugly patterns when scaling down too much
this.zoom_speed = 1.1 // in range (1.01, 2.5). Less than 1 will invert the zoom direction

this.title_text_font = "" + LiteGraph.NODE_TEXT_SIZE + "px Arial";
this.inner_text_font =
Expand Down Expand Up @@ -6899,9 +6900,9 @@ LGraphNode.prototype.executeAction = function(action)
var scale = this.ds.scale;

if (delta > 0) {
scale *= 1.1;
scale *= this.zoom_speed;
} else if (delta < 0) {
scale *= 1 / 1.1;
scale *= 1 / this.zoom_speed;
}

//this.setZoom( scale, [ e.clientX, e.clientY ] );
Expand Down

0 comments on commit 86d9391

Please sign in to comment.