From 86d93918073e1d02ab6fd8f568dc58f1533598e5 Mon Sep 17 00:00:00 2001 From: bymyself Date: Wed, 21 Aug 2024 08:44:55 -0700 Subject: [PATCH] Expose zoom speed option (#19) * Expose zoom speed option * Avoid unnecessary operations --- src/litegraph.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/litegraph.js b/src/litegraph.js index b623a5936..1d60dab83 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -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 = @@ -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 ] );