Skip to content

Commit 51a9ea7

Browse files
committed
Code refactoring
1 parent 066b0e3 commit 51a9ea7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/graph_spectrum.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
2929
try {
3030
let isFullscreen = false;
3131

32-
let sysConfig = flightLog.getSysConfig();
32+
const sysConfig = flightLog.getSysConfig();
3333
const logRateInfo = GraphSpectrumCalc.initialize(flightLog, sysConfig);
3434
GraphSpectrumPlot.initialize(analyserCanvas, sysConfig);
3535
GraphSpectrumPlot.setLogRateWarningInfo(logRateInfo);
36-
let analyserZoomXElem = $("#analyserZoomX");
37-
let analyserZoomYElem = $("#analyserZoomY");
36+
const analyserZoomXElem = $("#analyserZoomX");
37+
const analyserZoomYElem = $("#analyserZoomY");
3838
const analyserShiftPSDElem = $("#analyserShiftPSD");
3939
const analyserLowLevelPSDElem = $("#analyserLowLevelPSD");
4040

41-
let spectrumToolbarElem = $("#spectrumToolbar");
42-
let spectrumTypeElem = $("#spectrumTypeSelect");
43-
let overdrawSpectrumTypeElem = $("#overdrawSpectrumTypeSelect");
41+
const spectrumToolbarElem = $("#spectrumToolbar");
42+
const spectrumTypeElem = $("#spectrumTypeSelect");
43+
const overdrawSpectrumTypeElem = $("#overdrawSpectrumTypeSelect");
4444

4545
this.setFullscreen = function (size) {
4646
isFullscreen = size == true;
@@ -78,13 +78,13 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
7878
};
7979

8080
this.resize = function () {
81-
let newSize = getSize();
81+
const newSize = getSize();
8282

8383
// Determine the analyserCanvas location
8484
GraphSpectrumPlot.setSize(newSize.width, newSize.height);
8585

8686
// Recenter the analyser canvas in the bottom left corner
87-
let parentElem = $(analyserCanvas).parent();
87+
const parentElem = $(analyserCanvas).parent();
8888

8989
$(parentElem).css({
9090
left: newSize.left, // (canvas.width * getSize().left) + "px",
@@ -307,7 +307,7 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
307307
GraphSpectrumPlot.setOverdraw(userSettings.overdrawSpectrumType);
308308

309309
overdrawSpectrumTypeElem.change(function () {
310-
let optionSelected = parseInt(overdrawSpectrumTypeElem.val(), 10);
310+
const optionSelected = parseInt(overdrawSpectrumTypeElem.val(), 10);
311311

312312
if (optionSelected != userSettings.overdrawSpectrumType) {
313313
userSettings.overdrawSpectrumType = optionSelected;
@@ -331,9 +331,9 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
331331
// Hide the combo and maximize buttons
332332
spectrumToolbarElem.removeClass("non-shift");
333333

334-
let rect = analyserCanvas.getBoundingClientRect();
335-
let mouseX = e.clientX - rect.left;
336-
let mouseY = e.clientY - rect.top;
334+
const rect = analyserCanvas.getBoundingClientRect();
335+
const mouseX = e.clientX - rect.left;
336+
const mouseY = e.clientY - rect.top;
337337
if (mouseX != lastMouseX || mouseY != lastMouseY) {
338338
lastMouseX = mouseX;
339339
lastMouseY = mouseY;

0 commit comments

Comments
 (0)