Skip to content

Commit 39aa1f2

Browse files
committed
Code refactoring
1 parent 652c477 commit 39aa1f2

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
@@ -30,18 +30,18 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
3030
try {
3131
let isFullscreen = false;
3232

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

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

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

8181
this.resize = function () {
82-
let newSize = getSize();
82+
const newSize = getSize();
8383

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

8787
// Recenter the analyser canvas in the bottom left corner
88-
let parentElem = $(analyserCanvas).parent();
88+
const parentElem = $(analyserCanvas).parent();
8989

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

301301
overdrawSpectrumTypeElem.change(function () {
302-
let optionSelected = parseInt(overdrawSpectrumTypeElem.val(), 10);
302+
const optionSelected = parseInt(overdrawSpectrumTypeElem.val(), 10);
303303

304304
if (optionSelected != userSettings.overdrawSpectrumType) {
305305
userSettings.overdrawSpectrumType = optionSelected;
@@ -323,9 +323,9 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
323323
// Hide the combo and maximize buttons
324324
spectrumToolbarElem.removeClass("non-shift");
325325

326-
let rect = analyserCanvas.getBoundingClientRect();
327-
let mouseX = e.clientX - rect.left;
328-
let mouseY = e.clientY - rect.top;
326+
const rect = analyserCanvas.getBoundingClientRect();
327+
const mouseX = e.clientX - rect.left;
328+
const mouseY = e.clientY - rect.top;
329329
if (mouseX != lastMouseX || mouseY != lastMouseY) {
330330
lastMouseX = mouseX;
331331
lastMouseY = mouseY;

0 commit comments

Comments
 (0)