From bfb15faaae390495f3874bd32b76c654554a27ce Mon Sep 17 00:00:00 2001 From: Palazzini Luca Date: Mon, 16 Sep 2024 10:50:33 +0200 Subject: [PATCH] Fix borders on width or height being 0 --- web/widgets/graph_widget.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/widgets/graph_widget.js b/web/widgets/graph_widget.js index 92b50f4..d225557 100644 --- a/web/widgets/graph_widget.js +++ b/web/widgets/graph_widget.js @@ -23,7 +23,7 @@ function generateHslColor(value, max, alpha = 1.0, lightness = 50) { } function computeCanvasSize(node, size) { - if (node.widgets[3].last_y == null) { + if (node.widgets[0].last_y == null) { return; } const yBase = WIDGET_BASE_HEIGHT * Math.max(node.inputs.length, node.outputs.length) + 5; @@ -54,7 +54,7 @@ export function addAreaGraphWidget(node) { name: "AreaConditioningCanvas", draw: function(ctx, node, widgetWidth, widgetY) { if (!node.canvasHeight) { - computeCanvasSize(node, node.size) + computeCanvasSize(node, node.size); } // Canvas variables const transform = ctx.getTransform(); @@ -93,6 +93,9 @@ export function addAreaGraphWidget(node) { } // Draws a rectangle on the canvas const drawRect = (x, y, w, h, color) => { + if (w <= 0 || h <= 0) { + return; + } ctx.fillStyle = color; ctx.fillRect(x, y, w, h); };