-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.js
54 lines (45 loc) · 2.25 KB
/
ui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Any globals are defined here.
// Global array of tracks. Can have two tracks.
var tracks = [[], []];
function fileLoadCompleteCallback() {
drawPolars();
drawMap();
}
(function initPage() {
// Set up the slider.
var angleSlider = document.getElementById("angle");
document.getElementById("current_angle").innerHTML = "Current Angle: " + angleSlider.value;
angleSlider.addEventListener("change", function(){
document.getElementById("current_angle").innerHTML = "Current Angle: " + angleSlider.value;
drawPolars();
}, false);
// Set up the file loaders.
var jsonFileInput1 = document.getElementById("gpx1");
var jsonFileInput2 = document.getElementById("gpx2");
// loadTrackFromFile defined in polars.js
jsonFileInput1.addEventListener("change", loadTrackFromFile, false);
jsonFileInput2.addEventListener("change", loadTrackFromFile, false);
document.getElementById("advanced_settings_toggle").addEventListener("click", function() {
if (document.getElementById("advanced_settings").style.display == "") {
document.getElementById("advanced_settings").style.display = "none";
document.getElementById("advanced_settings_toggle").innerHTML =
document.getElementById("advanced_settings_toggle").innerHTML.replace(/\-/, "+");
} else {
document.getElementById("advanced_settings").style.display = "";
document.getElementById("advanced_settings_toggle").innerHTML =
document.getElementById("advanced_settings_toggle").innerHTML.replace(/\+/, "-");
}
}, false);
document.getElementById("bucket_size").addEventListener("change", function() {
bucketDegreeIncrement = Math.floor(document.getElementById("bucket_size").value);
drawPolars();
}, false);
document.getElementById("seconds_course").addEventListener("change", function() {
directionTimeIntervalSecs = Math.floor(document.getElementById("seconds_course").value);
drawPolars();
}, false);
document.getElementById("secondary_offset_degrees").addEventListener("change", function() {
secondaryAdjustment = parseFloat(document.getElementById("secondary_offset_degrees").value);
drawPolars();
}, false);
})();