Skip to content

Commit f2eb64b

Browse files
author
Gary Keeble
committed
Make the Analyser an Option
Added drawAnalyser option to default options
1 parent d1ffdd6 commit f2eb64b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

js/grapher.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, options)
5353
defaultOptions = {
5454
gapless:false,
5555
drawCraft:"3D", drawPidTable:true, drawSticks:true, drawTime:true,
56+
drawAnalyser:true, // add an analyser option
5657
eraseBackground: true // Set to false if you want the graph to draw on top of an existing canvas image
5758
},
5859

@@ -78,9 +79,6 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, options)
7879

7980
this.onSeek = null;
8081

81-
/* Create the FlightLogAnalyser object */
82-
analyser = new FlightLogAnalyser(flightLog, graphConfig, canvas, craftCanvas, options);
83-
8482
function extend(base, top) {
8583
var
8684
target = {};
@@ -817,7 +815,7 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, options)
817815
}
818816

819817
// Draw Analyser
820-
if (analyser) { /* OK this is bad.. just pointing to the first graph for now! */
818+
if (options.drawAnalyser) { /* OK this is bad.. just pointing to the first graph for now! */
821819

822820
// Really should have method of selecting the graph/field I want an FFT for!
823821
var graph = graphs[0]; // The first graph
@@ -954,6 +952,9 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, options)
954952
identifyFields();
955953

956954
initializeCraftModel();
955+
956+
/* Create the FlightLogAnalyser object */
957+
analyser = new FlightLogAnalyser(flightLog, graphConfig, canvas, craftCanvas, options);
957958

958959
//Handle dragging events
959960
$(canvas).on("mousedown", onMouseDown);

0 commit comments

Comments
 (0)