Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
only show visible sondes on sidebar (projecthorus#252)
  • Loading branch information
LukePrior authored Mar 28, 2022
commit d7705ddba2ffd2b9f7eb4f46a51158eb9e2a775f
7 changes: 7 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ <h4>Visibility</h4>
<input type="checkbox" id="opt_layers_launches">
</div>
</div>
<div class="row option">
<span><b>Only show visible on sidebar</b></span>
<div class="switch off" id="sw_selective_sidebar">
<span class="thumb"></span>
<input type="checkbox" id="opt_selective_sidebar">
</div>
</div>
<h4>Other</h4>
<hr/>
<div class="row option">
Expand Down
4 changes: 4 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ $(window).ready(function() {
'#sw_hide_horizon',
'#sw_hide_titles',
'#sw_layers_launches',
'#sw_selective_sidebar',
"#sw_nowelcome",
"#sw_interpolate",
];
Expand Down Expand Up @@ -820,6 +821,9 @@ $(window).ready(function() {
if(on) map.overlayMapTypes.setAt("1", overlayAPRS);
else map.overlayMapTypes.setAt("1", null);
break;
case "opt_selective_sidebar":
sidebar_update();
break;
case "opt_layers_launches":
if(on) {
map.removeLayer(launches);
Expand Down
26 changes: 26 additions & 0 deletions js/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ function load() {

map.on('moveend', function (e) {
lhash_update();
sidebar_update();
});

map.on('baselayerchange', function (e) {
Expand Down Expand Up @@ -926,6 +927,7 @@ function load() {

map.on('moveend', function() {
lhash_update();
sidebar_update();
});
map.on('baselayerchange', function() {
lhash_update();
Expand Down Expand Up @@ -1053,6 +1055,22 @@ function panToRecovery(rcallsign) {
}
}

function sidebar_update() {
if (offline.get('opt_selective_sidebar')) {
for (let serial in vehicles) {
if (map.getBounds().contains(vehicles[serial].marker.getLatLng())) {
$("#main .vehicle"+vehicles[serial].uuid).show();
} else {
$("#main .vehicle"+vehicles[serial].uuid).hide();
}
}
} else {
for (let serial in vehicles) {
$("#main .vehicle"+vehicles[serial].uuid).show();
}
}
}

function title_case(s) {
return s.replace(/\w\S*/g, function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
Expand Down Expand Up @@ -1528,6 +1546,14 @@ function updateVehicleInfo(vcallsign, newPosition) {
$('.landscape').append('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
}

if (offline.get('opt_selective_sidebar')) {
if (map.getBounds().contains(vehicles[vcallsign].marker.getLatLng())) {
$("#main .vehicle"+vehicle.uuid).show();
} else {
$("#main .vehicle"+vehicle.uuid).hide();
}
}

} else if(elm.attr('data-vcallsign') === undefined) {
elm.attr('data-vcallsign', vcallsign);
}
Expand Down