From cb8c35c760351fcd4cecc3c9cd200a922662f8ee Mon Sep 17 00:00:00 2001 From: Baldur Gislason Date: Wed, 5 Apr 2023 15:21:17 +0000 Subject: [PATCH] Preventing slider from rendering outside its designated area if value it is based on is outside the expected range. --- src/litegraph.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/litegraph.js b/src/litegraph.js index bc1a34e86..4effe006e 100644 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -9732,6 +9732,8 @@ LGraphNode.prototype.executeAction = function(action) ctx.fillRect(margin, y, widget_width - margin * 2, H); var range = w.options.max - w.options.min; var nvalue = (w.value - w.options.min) / range; + if(nvalue < 0.0) nvalue = 0.0; + if(nvalue > 1.0) nvalue = 1.0; ctx.fillStyle = active_widget == w ? "#89A" : "#678"; ctx.fillRect(margin, y, nvalue * (widget_width - margin * 2), H); if(show_text && !w.disabled)