Skip to content

Commit 4606c37

Browse files
committed
Code style improvement
1 parent 7104be8 commit 4606c37

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/graph_spectrum_plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ GraphSpectrumPlot._drawPowerSpectralDensityGraph = function (canvasCtx) {
431431
};
432432

433433
GraphSpectrumPlot._drawLegend = function (canvasCtx, WIDTH, HEIGHT, importedCurves) {
434-
if (!userSettings?.analyser_legend) {
434+
if (!userSettings?.analyser_legend?.left || !userSettings?.analyser_legend?.top || !userSettings?.analyser_legend?.width) {
435435
return;
436436
}
437437
const spectrumCount = importedCurves.length,
@@ -452,7 +452,7 @@ GraphSpectrumPlot._drawLegend = function (canvasCtx, WIDTH, HEIGHT, importedCurv
452452
canvasCtx.textAlign = "left";
453453
for (let row = 0; row < spectrumCount; row++) {
454454
const curvesName = importedCurves[row].name;
455-
const Y = legendPosY + padding + rowHeight * (row + 1);
455+
const Y = legendPosY + padding + rowHeight * row + rowHeight/2; // Center text vertically
456456
canvasCtx.strokeStyle = this.curvesColors[row];
457457
canvasCtx.strokeText(curvesName, legendPosX + padding, Y);
458458
}

0 commit comments

Comments
 (0)