diff --git a/bin/color-utilities.js b/bin/color-utilities.js index 59ee55d..ab11d23 100644 --- a/bin/color-utilities.js +++ b/bin/color-utilities.js @@ -136,6 +136,10 @@ export function getGradientSteps(minEvalue, maxEvalue, minEvalueNotZero, colorSc * h, s, v */ export function HSVtoRGB(h, s, v) { + // Clamp input values to the expected range [0, 1] + h = Math.min(Math.max(h, 0), 1); + s = Math.min(Math.max(s, 0), 1); + v = Math.min(Math.max(v, 0), 1); let r = 0; let g = 0; let b = 0; diff --git a/bin/drawing-utilities.js b/bin/drawing-utilities.js index 5979a3f..ae8bb06 100644 --- a/bin/drawing-utilities.js +++ b/bin/drawing-utilities.js @@ -574,7 +574,7 @@ export function drawFooterText(renderOptions, topPadding) { textObj.evented = true; textObj.top = topPadding; textObj.left = 225; - const copyright = `European Bioinformatics Institute 2006-2022. ` + + const copyright = `European Bioinformatics Institute 2006-2024. ` + `EBI is an Outstation of the European Molecular Biology Laboratory.`; const copyrightText = new fabric.Text(`${copyright}`, textObj); return [copyrightText, textObj]; diff --git a/bin/other-utilities.js b/bin/other-utilities.js index 71bec6f..3fac322 100644 --- a/bin/other-utilities.js +++ b/bin/other-utilities.js @@ -50,18 +50,18 @@ export class ObjectCache { } } } -function countDecimals(n) { +export function countDecimals(n) { if (Math.floor(n) === n) return 0; return n.toString().split('.')[1].length || 0; } export function numberToString(n) { - if (Number.isInteger(n)) { - return n + '.0'; - } - else if (n < 0.0001 || n > 10000) { + if (n < 0.0001 || n > 10000) { return n.toExponential(2); } + else if (Number.isInteger(n)) { + return n + '.0'; + } else if (countDecimals(n) > 3) { return n.toFixed(3).toString(); }