Hide the altitude chart and checkbox if using custom colors since the chart is based on default colors

This commit is contained in:
James Wilson 2017-02-22 12:17:18 -06:00
parent e0e09ed3a4
commit f23bdb21f6
2 changed files with 15 additions and 1 deletions

View file

@ -221,7 +221,7 @@
<div class="settingsCheckbox" id="acpositions_checkbox"></div>
<div class="settingsText">Aircraft Positions</div>
</div>
<div class="settingsOptionContainer">
<div class="settingsOptionContainer" id="altitude_chart_container">
<div class="settingsCheckbox" id="altitude_checkbox"></div>
<div class="settingsText">Altitude Chart</div>
</div>

View file

@ -15,6 +15,7 @@ var SelectedAllPlanes = false;
var HighlightedPlane = null;
var FollowSelected = false;
var infoBoxOriginalPosition = {};
var customAltitudeColors = true;
var SpecialSquawks = {
'7500' : { cssClass: 'squawk7500', markerColor: 'rgb(255, 85, 85)', text: 'Aircraft Hijacking' },
@ -235,6 +236,13 @@ function initialize() {
}
}
});
// check if the altitude color values are default to enable the altitude filter
if (ColorByAlt.air.h.length === 3 && ColorByAlt.air.h[0].alt === 2000 && ColorByAlt.air.h[0].val === 20 && ColorByAlt.air.h[1].alt === 10000 && ColorByAlt.air.h[1].val === 140 && ColorByAlt.air.h[2].alt === 40000 && ColorByAlt.air.h[2].val === 300) {
customAltitudeColors = false;
}
$("#altitude_filter_reset_button").click(onResetAltitudeFilter);
$('#settingsCog').on('click', function() {
@ -1544,6 +1552,12 @@ function toggleAltitudeChart(switchToggle) {
if (switchToggle === true) {
altitudeChartDisplay = (altitudeChartDisplay === 'show') ? 'hidden' : 'show';
}
// if you're using custom colors always hide the chart
if (customAltitudeColors === true) {
altitudeChartDisplay = 'hidden';
// also hide the control option
$('#altitude_chart_container').hide();
}
if (altitudeChartDisplay === 'show') {
$('#altitude_checkbox').addClass('settingsCheckboxChecked');
$('#altitude_chart').show();