Skip to content

Commit e28955b

Browse files
committed
resolved issue of wrong legend drawing code placement
1 parent d179161 commit e28955b

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/graph_spectrum_plot.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -262,29 +262,29 @@ GraphSpectrumPlot._drawFrequencyGraph = function (canvasCtx) {
262262
canvasCtx.lineTo(curvesPonts[pointNum].freq * scaleX, HEIGHT - middleValue * fftScale);
263263
}
264264
canvasCtx.stroke();
265+
}
265266

266-
//Legend draw
267-
if (this._isFullScreen) {
268-
const legendPosX = 0.84 * WIDTH,
269-
legendPosY = 0.6 * HEIGHT,
270-
rowHeight = 16,
271-
padding = 4,
272-
legendWidth = 0.13 * WIDTH + padding,
273-
legendHeight = spectrumCount * rowHeight + 3 * padding;
274-
275-
const legendArea = new Path2D();
276-
legendArea.rect(legendPosX, legendPosY, legendWidth, legendHeight);
277-
canvasCtx.clip(legendArea);
278-
canvasCtx.strokeStyle = "gray";
279-
canvasCtx.strokeRect(legendPosX, legendPosY, legendWidth, legendHeight);
280-
canvasCtx.font = `${this._drawingParams.fontSizeFrameLabelFullscreen}pt ${DEFAULT_FONT_FACE}`;
281-
canvasCtx.textAlign = "left";
282-
for (let row = 0; row < spectrumCount; row++) {
283-
const curvesName = this._importedSpectrumsData[row].name.split('.')[0];
284-
const Y = legendPosY + padding + rowHeight * (row + 1);
285-
canvasCtx.strokeStyle = curvesColors[row];
286-
canvasCtx.strokeText(curvesName, legendPosX + padding, Y);
287-
}
267+
//Legend draw
268+
if (this._isFullScreen) {
269+
const legendPosX = 0.84 * WIDTH,
270+
legendPosY = 0.6 * HEIGHT,
271+
rowHeight = 16,
272+
padding = 4,
273+
legendWidth = 0.13 * WIDTH + padding,
274+
legendHeight = spectrumCount * rowHeight + 3 * padding;
275+
276+
const legendArea = new Path2D();
277+
legendArea.rect(legendPosX, legendPosY, legendWidth, legendHeight);
278+
canvasCtx.clip(legendArea);
279+
canvasCtx.strokeStyle = "gray";
280+
canvasCtx.strokeRect(legendPosX, legendPosY, legendWidth, legendHeight);
281+
canvasCtx.font = `${this._drawingParams.fontSizeFrameLabelFullscreen}pt ${DEFAULT_FONT_FACE}`;
282+
canvasCtx.textAlign = "left";
283+
for (let row = 0; row < spectrumCount; row++) {
284+
const curvesName = this._importedSpectrumsData[row].name.split('.')[0];
285+
const Y = legendPosY + padding + rowHeight * (row + 1);
286+
canvasCtx.strokeStyle = curvesColors[row];
287+
canvasCtx.strokeText(curvesName, legendPosX + padding, Y);
288288
}
289289
}
290290
canvasCtx.restore();

0 commit comments

Comments
 (0)