Preventing slider from rendering outside its designated area if value it is based on is outside the expected range.

This commit is contained in:
Baldur Gislason
2023-04-05 15:21:17 +00:00
parent 8bd5315ba6
commit cb8c35c760

View File

@@ -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)