clean up missing images in radar parsing

This commit is contained in:
Matt Walsh
2020-09-08 15:21:11 -05:00
parent 560d3a8cb2
commit 32d2b5d1cd
3 changed files with 25 additions and 7 deletions

View File

@@ -183,6 +183,14 @@ const navigation = (() => {
// navigate to next or previous
const navTo = (direction) => {
// test for a current display
const current = currentDisplay();
if (!current) {
// special case for no active displays (typically on progress screen)
progress.hideCanvas();
displays[0].navNext(msg.command.firstFrame);
return;
}
if (direction === msg.command.nextFrame) currentDisplay().navNext();
if (direction === msg.command.previousFrame) currentDisplay().navPrev();
};
@@ -208,8 +216,6 @@ const navigation = (() => {
// get the current display index or value
const currentDisplayIndex = () => {
let index = displays.findIndex(display=>display.isActive());
// if there is no active display, default to the first one
if (index === -1) index = displays.length-1;
return index;
};
const currentDisplay = () => {
@@ -235,6 +241,11 @@ const navigation = (() => {
setPlaying(false);
navTo(msg.command.previousFrame);
break;
case 'menu':
setPlaying(false);
progress.showCanvas();
hideAllCanvases();
break;
default:
console.error(`Unknown navButton ${button}`);
}