@@ -17,15 +17,16 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
1717 let that = this ,
1818 analyserZoomX = 1.0 /* 100% */ ,
1919 analyserZoomY = 1.0 /* 100% */ ,
20- dataBuffer = {
21- fieldIndex : 0 ,
22- curve : 0 ,
23- fieldName : null ,
24- } ,
2520 dataReload = false ,
2621 fftData = null ,
2722 prefs = new PrefStorage ( ) ;
2823
24+ this . dataBuffer = {
25+ fieldIndex : 0 ,
26+ curve : 0 ,
27+ fieldName : null ,
28+ } ;
29+
2930 try {
3031 let isFullscreen = false ;
3132
@@ -100,9 +101,8 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
100101 } ) ;
101102 } ;
102103
103- let dataLoad = function ( ) {
104- GraphSpectrumCalc . setDataBuffer ( dataBuffer ) ;
105-
104+ const dataLoad = function ( ) {
105+ GraphSpectrumCalc . setDataBuffer ( that . dataBuffer ) ;
106106 switch ( userSettings . spectrumType ) {
107107 case SPECTRUM_TYPE . FREQ_VS_THROTTLE :
108108 fftData = GraphSpectrumCalc . dataLoadFrequencyVsThrottle ( ) ;
@@ -128,19 +128,16 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
128128 analyser on screen*/
129129 this . plotSpectrum = function ( fieldIndex , curve , fieldName ) {
130130 // Store the data pointers
131- dataBuffer = {
132- fieldIndex : fieldIndex ,
133- curve : curve ,
134- fieldName : fieldName ,
135- } ;
136131
132+ that . dataBuffer . fieldIndex = fieldIndex ;
133+ that . dataBuffer . curve = curve ;
134+ that . dataBuffer . fieldName = fieldName ;
137135 // Detect change of selected field.... reload and redraw required.
138136 if ( fftData == null || fieldIndex != fftData . fieldIndex || dataReload ) {
139137 dataReload = false ;
140138 dataLoad ( ) ;
141139 GraphSpectrumPlot . setData ( fftData , userSettings . spectrumType ) ;
142140 }
143-
144141 that . draw ( ) ; // draw the analyser on the canvas....
145142 } ;
146143
@@ -211,9 +208,9 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
211208 // Recalculate the data, for the same curve than now, and draw it
212209 dataReload = true ;
213210 that . plotSpectrum (
214- dataBuffer . fieldIndex ,
215- dataBuffer . curve ,
216- dataBuffer . fieldName
211+ that . dataBuffer . fieldIndex ,
212+ that . dataBuffer . curve ,
213+ that . dataBuffer . fieldName
217214 ) ;
218215 }
219216
0 commit comments