From 7bd4a1591f878e678b93476f6a3b31066cc7977a Mon Sep 17 00:00:00 2001 From: l_samenv Date: Mon, 19 Aug 2024 16:51:21 +0200 Subject: [PATCH] Fixed legend anchor bug --- client/jsFiles/SEAWebClientGraphics.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/jsFiles/SEAWebClientGraphics.js b/client/jsFiles/SEAWebClientGraphics.js index 69be3b7..6f45c18 100644 --- a/client/jsFiles/SEAWebClientGraphics.js +++ b/client/jsFiles/SEAWebClientGraphics.js @@ -1359,7 +1359,7 @@ function Graph(gindex, container, x_label, y_label, tag, scaleType = "linear"){ let legendAnchor = document.createElement('div'); legendAnchor.classList.add('legendanchor'); parent.appendChild(legendAnchor); - + let hasLegendAnchor = false; //graphSwiper.appendSlide(parent); let controls = document.createElement('div'); controls.classList.add('controls'); @@ -1463,6 +1463,7 @@ function Graph(gindex, container, x_label, y_label, tag, scaleType = "linear"){ let mid = y + lrect.height / 2; if (mid >= 0 && mid <= prect.height) { legendAnchor.style.display = 'none'; + hasLegendAnchor = false; return; } if (y < 0) { @@ -1473,6 +1474,7 @@ function Graph(gindex, container, x_label, y_label, tag, scaleType = "linear"){ legendAnchor.style.display = 'inline-block'; legendAnchor.style.left = x + lrect.width + 'px'; legendAnchor.style.top = y + 'px'; + hasLegendAnchor = true; } /** @@ -1546,9 +1548,13 @@ function Graph(gindex, container, x_label, y_label, tag, scaleType = "linear"){ function showLegend(flag){ if (flag) { legend.style.display = 'flex'; + if (hasLegendAnchor) + legendAnchor.style.display = 'inline-block'; } else { graphs.cursorLine(null); legend.style.display = 'none'; + if (hasLegendAnchor) + legendAnchor.style.display = 'none'; } }