We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 492b7a5 + ca1d754 commit 9be2c84Copy full SHA for 9be2c84
1 file changed
src/litegraph.js
@@ -9990,7 +9990,14 @@ LGraphNode.prototype.executeAction = function(action)
9990
var delta = x < 40 ? -1 : x > widget_width - 40 ? 1 : 0;
9991
if (event.click_time < 200 && delta == 0) {
9992
this.prompt("Value",w.value,function(v) {
9993
- inner_value_change(this, this.value);
+ // check if v is a valid equation or a number
9994
+ if (/^[0-9+\-*/()\s]+$/.test(v)) {
9995
+ try {//solve the equation if possible
9996
+ v = eval(v);
9997
+ } catch (e) { }
9998
+ }
9999
+ this.value = Number(v);
10000
+ inner_value_change(this, this.value);
10001
}.bind(w),
10002
event);
10003
}
0 commit comments