From 0a6225a13d791a09723864643c7d60421c15b916 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Sun, 2 Jun 2024 19:19:23 -0400 Subject: [PATCH] Sorting bands by low_band for in-order rendering. --- htdocs/lib/Bandplan.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/lib/Bandplan.js b/htdocs/lib/Bandplan.js index c28d65f6..93a52c1a 100644 --- a/htdocs/lib/Bandplan.js +++ b/htdocs/lib/Bandplan.js @@ -29,7 +29,12 @@ Bandplan.prototype.getColor = function(type) { }; Bandplan.prototype.update = function(bands) { - this.bands = bands; + // Sort by low_bound for accurate rendering of overlapping bands + this.bands = bands.sort(function (a, b) { + return a.low_bound - b.low_bound; + }); + + // Draw new bands this.draw(); };