Skip to content

Commit 7f0846e

Browse files
committed
The code refactoring for adding main spectrum curve to imported list
1 parent b55b887 commit 7f0846e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/graph_spectrum.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,17 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
163163
}
164164
};
165165

166+
this.shouldAddCurrentSpectrumBeforeReload = function () {
167+
return addSpectrumToImport && fftData != null && !this.isMultiSpectrum() && !dataReload;
168+
};
169+
166170
/* This function is called from the canvas drawing routines within grapher.js
167171
It is only used to record the current curve positions, collect the data and draw the
168172
analyser on screen*/
169173
this.plotSpectrum = function (fieldIndex, curve, fieldName) {
170174
// Detect change of selected field.... reload and redraw required.
171175
if (fftData == null || fieldIndex != fftData.fieldIndex || dataReload) {
172-
if (addSpectrumToImport && fftData != null && !this.isMultiSpectrum() && !dataReload) {
176+
if (this.shouldAddCurrentSpectrumBeforeReload()) {
173177
this.addCurrentSpectrumIntoImport(); // The main curve is added into imported list when the second curve is selected for comparison
174178
}
175179
dataReload = false;

0 commit comments

Comments
 (0)