Skip to content

Commit 9ec215b

Browse files
committed
Locked the curves PSD spectrum selection while import has maximal curves count
1 parent 8965447 commit 9ec215b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/graph_imported_curves.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,12 @@ export function ImportedCurves(curvesChanged) {
105105
this.maxY = -Number.MAX_VALUE;
106106
curvesChanged();
107107
};
108+
109+
this.isFull = function() {
110+
return this.curvesCount() === maxImportCount;
111+
};
112+
113+
this.isEmpty = function() {
114+
return this.curvesCount() === 0;
115+
};
108116
}

src/graph_spectrum.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
172172
analyser on screen*/
173173
this.plotSpectrum = function (fieldIndex, curve, fieldName) {
174174
// Detect change of selected field.... reload and redraw required.
175-
if (fftData == null || fieldIndex != fftData.fieldIndex || dataReload) {
175+
const isMaxCountOfImportedPSD = GraphSpectrumPlot.isImportedCurvesMaxCount() && userSettings.spectrumType === SPECTRUM_TYPE.POWER_SPECTRAL_DENSITY;
176+
const shouldReload = fftData == null ||
177+
fieldIndex != fftData.fieldIndex && !isMaxCountOfImportedPSD || // Lock spectrum data reload while PSD curves import is full
178+
dataReload;
179+
if (shouldReload) {
176180
if (this.shouldAddCurrentSpectrumBeforeReload()) {
177181
this.addCurrentSpectrumIntoImport(); // The main curve is added into imported list when the second curve is selected for comparison
178182
}

src/graph_spectrum_plot.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1839,6 +1839,9 @@ GraphSpectrumPlot.addCurrentSpectrumIntoImport = function() {
18391839
};
18401840

18411841
GraphSpectrumPlot.isMultiSpectrum = function() {
1842-
return this._importedPSD.curvesCount() > 0;
1842+
return !this._importedPSD.isEmpty();
18431843
};
18441844

1845+
GraphSpectrumPlot.isImportedCurvesMaxCount = function() {
1846+
return this._importedPSD.isFull();
1847+
};

0 commit comments

Comments
 (0)