From b3c8427232199b3531883047623ae818b1955e7b Mon Sep 17 00:00:00 2001 From: Baldur Gislason Date: Wed, 5 Apr 2023 15:27:09 +0000 Subject: [PATCH] Make the marker also stay within the designated area --- src/litegraph.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/litegraph.js b/src/litegraph.js index 53ebfc7720..9bdb5720f1 100644 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -9740,6 +9740,8 @@ LGraphNode.prototype.executeAction = function(action) ctx.strokeRect(margin, y, widget_width - margin * 2, H); if (w.marker) { var marker_nvalue = (w.marker - w.options.min) / range; + if(marker_nvalue < 0.0) marker_nvalue = 0.0; + if(marker_nvalue > 1.0) marker_nvalue = 1.0; ctx.fillStyle = w.hasOwnProperty("marker_color") ? w.marker_color : "#AA9"; ctx.fillRect( margin + marker_nvalue * (widget_width - margin * 2), y, 2, H ); }