clickable navigation

This commit is contained in:
Matt Walsh 2020-09-08 16:27:03 -05:00
parent 0e5d831f4a
commit 6a2317d283
6 changed files with 24 additions and 6 deletions

2
dist/index.html vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/twc3.html vendored
View file

@ -1 +1 @@
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8"><link rel="preload" href="fonts/Star4000.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star 4 Radar.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Extended.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large Compressed.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Small.woff" as="font" crossorigin="anonymous"><link rel="stylesheet" type="text/css" href="resources/twc3.min.css?_=2.3.0"><script type="text/javascript" src="resources/data.min.js"></script><script type="text/javascript" src="resources/ws.min.js?_=2.3.0"></script></head><body><div id="version" style="display:none">2.3.0</div><div id="container"></div></body></html>
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8"><link rel="preload" href="fonts/Star4000.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star 4 Radar.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Extended.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large Compressed.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Small.woff" as="font" crossorigin="anonymous"><link rel="stylesheet" type="text/css" href="resources/twc3.min.css?_=2.3.1"><script type="text/javascript" src="resources/data.min.js"></script><script type="text/javascript" src="resources/ws.min.js?_=2.3.1"></script></head><body><div id="version" style="display:none">2.3.1</div><div id="container"></div></body></html>

View file

@ -251,6 +251,9 @@ const navigation = (() => {
}
};
// return the specificed display
const getDisplay = (index) => displays[index];
return {
init,
updateStatus,
@ -258,5 +261,6 @@ const navigation = (() => {
isPlaying,
displayNavMessage,
msg,
getDisplay,
};
})();

View file

@ -1,6 +1,6 @@
// regional forecast and observations
/* globals WeatherDisplay, utils, STATUS, draw */
/* globals WeatherDisplay, utils, STATUS, draw, navigation */
// eslint-disable-next-line no-unused-vars
class Progress extends WeatherDisplay {
@ -93,6 +93,20 @@ class Progress extends WeatherDisplay {
}
canvasClick(e) {
console.log(e);
const x = e.offsetX;
const y = e.offsetY;
console.log(x,y);
// eliminate off canvas and outside area clicks
if (!this.isActive()) return;
if (y < 100 || y > 410) return;
if (x < 440 || x > 570) return;
// use the y value to determine an index
const index = Math.floor((y-100)/29);
const display = navigation.getDisplay(index);
if (display && display.status === STATUS.loaded) {
display.showCanvas(navigation.msg.command.firstFrame);
this.hideCanvas();
}
}
}

View file

@ -1 +1 @@
module.exports = '2.3.0';
module.exports = '2.3.1';