From b566f23b945962a4e101440dc1425a5d58f839a2 Mon Sep 17 00:00:00 2001 From: omar92 Date: Tue, 4 Apr 2023 19:08:41 +0200 Subject: [PATCH] try to solve the input equation --- web/lib/litegraph.core.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/lib/litegraph.core.js b/web/lib/litegraph.core.js index 862d59067..bd6ccbdb8 100644 --- a/web/lib/litegraph.core.js +++ b/web/lib/litegraph.core.js @@ -9994,6 +9994,12 @@ LGraphNode.prototype.executeAction = function(action) var delta = x < 40 ? -1 : x > widget_width - 40 ? 1 : 0; if (event.click_time < 200 && delta == 0) { this.prompt("Value",w.value,function(v) { + + try {//solve the equation if possible + v = eval(v); + } catch (error) { + } + this.value = Number(v); inner_value_change(this, this.value); }.bind(w),