From c09e5fd7139a7859a33528a1d52949c2ca1b8b35 Mon Sep 17 00:00:00 2001 From: Aghasi Poghosyan Date: Sun, 4 Feb 2024 23:56:19 +0400 Subject: [PATCH 1/2] Fix mouse and trackpad zoom behavior * make zoom behavior smooth and friendly * Tested with MacBook trackpad and Ubuntu mouse works excellent. --- src/litegraph.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/litegraph.js b/src/litegraph.js index 359f6e1d0..58ef5cfb8 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -7006,11 +7006,7 @@ LGraphNode.prototype.executeAction = function(action) var scale = this.ds.scale; - if (delta > 0) { - scale *= 1.1; - } else if (delta < 0) { - scale *= 1 / 1.1; - } + scale *= Math.pow(1.2, delta * 0.01); //this.setZoom( scale, [ e.clientX, e.clientY ] ); this.ds.changeScale(scale, [e.clientX, e.clientY]); From 8d6fbe6c2b18ff1ace3e72e57fb65379b226d63c Mon Sep 17 00:00:00 2001 From: Aghasi Poghosyan Date: Tue, 14 May 2024 15:52:59 +0400 Subject: [PATCH 2/2] Adjust zoom behavior to be near previews user experience --- src/litegraph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/litegraph.js b/src/litegraph.js index 58ef5cfb8..a34efcaf2 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -7006,7 +7006,7 @@ LGraphNode.prototype.executeAction = function(action) var scale = this.ds.scale; - scale *= Math.pow(1.2, delta * 0.01); + scale *= Math.pow(1.1, delta * 0.01); //this.setZoom( scale, [ e.clientX, e.clientY ] ); this.ds.changeScale(scale, [e.clientX, e.clientY]);