Expose zoom speed option (#19)

* Expose zoom speed option

* Avoid unnecessary operations
This commit is contained in:
bymyself
2024-08-21 08:44:55 -07:00
committed by GitHub
parent 652fcb6fb5
commit 86d9391807

View File

@@ -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 ] );