mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-17 00:59:29 -07:00
separate data and css
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
class Almanac extends WeatherDisplay {
|
||||
constructor(navId,elemId,weatherParameters) {
|
||||
super(navId,elemId);
|
||||
super(navId,elemId,'Almanac');
|
||||
|
||||
// pre-load background image (returns promise)
|
||||
this.backgroundImage = utils.image.load('images/BackGround1_1.png');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
class CurrentWeather extends WeatherDisplay {
|
||||
constructor(navId,elemId,weatherParameters) {
|
||||
super(navId,elemId);
|
||||
super(navId,elemId,'Current Conditions');
|
||||
// pre-load background image (returns promise)
|
||||
this.backgroundImage = utils.image.load('images/BackGround1_1.png');
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
class ExtendedForecast extends WeatherDisplay {
|
||||
constructor(navId,elemId,weatherParameters) {
|
||||
super(navId,elemId);
|
||||
super(navId,elemId,'Extended Forecast');
|
||||
|
||||
// set timings
|
||||
this.timing.totalScreens = 2;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
class LatestObservations extends WeatherDisplay {
|
||||
constructor(navId,elemId, weatherParameters) {
|
||||
super(navId,elemId);
|
||||
super(navId,elemId,'Latest Observations');
|
||||
// pre-load background image (returns promise)
|
||||
this.backgroundImage = utils.image.load('images/BackGround1_1.png');
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ const navigation = (() => {
|
||||
},
|
||||
};
|
||||
|
||||
// receive naivgation messages from displays
|
||||
// receive navigation messages from displays
|
||||
const displayNavMessage = (message) => {
|
||||
if (message.type === msg.response.previous) loadDisplay(-1);
|
||||
if (message.type === msg.response.next) loadDisplay(1);
|
||||
@@ -208,8 +208,9 @@ const navigation = (() => {
|
||||
|
||||
// get the current display index or value
|
||||
const currentDisplayIndex = () => {
|
||||
const index = displays.findIndex(display=>display.isActive());
|
||||
if (index === undefined) console.error('No active display');
|
||||
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 = () => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
class Radar extends WeatherDisplay {
|
||||
constructor(navId,elemId,weatherParameters) {
|
||||
super(navId,elemId);
|
||||
super(navId,elemId,'Local Radar');
|
||||
|
||||
// set max images
|
||||
this.dopplerRadarImageMax = 6;
|
||||
@@ -134,9 +134,6 @@ class Radar extends WeatherDisplay {
|
||||
workingContext.drawImage(imgBlob, 0, 0, 2550, 1600);
|
||||
}
|
||||
|
||||
// clean the image
|
||||
this.removeDopplerRadarImageNoise(workingContext);
|
||||
|
||||
// get the base map
|
||||
context.drawImage(await this.baseMap, sourceXY.x, sourceXY.y, offsetX*2, offsetY*2, 0, 0, 640, 367);
|
||||
|
||||
@@ -147,6 +144,8 @@ class Radar extends WeatherDisplay {
|
||||
const cropContext = cropCanvas.getContext('2d');
|
||||
cropContext.imageSmoothingEnabled = false;
|
||||
cropContext.drawImage(workingCanvas, radarSourceX, radarSourceY, (radarOffsetX * 2), (radarOffsetY * 2.33), 0, 0, 640, 367);
|
||||
// clean the image
|
||||
this.removeDopplerRadarImageNoise(cropContext);
|
||||
|
||||
// merge the radar and map
|
||||
this.mergeDopplerRadarImage(context, cropContext);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
class RegionalForecast extends WeatherDisplay {
|
||||
constructor(navId,elemId, weatherParameters, period) {
|
||||
super(navId,elemId);
|
||||
super(navId,elemId,'Regional Forecast');
|
||||
// store the period, see above
|
||||
this.period = period;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
class TravelForecast extends WeatherDisplay {
|
||||
constructor(navId, elemId, weatherParameters) {
|
||||
// special height and width for scrolling
|
||||
super(navId, elemId);
|
||||
super(navId, elemId, 'Travel Forecast');
|
||||
// pre-load background image (returns promise)
|
||||
this.backgroundImage = utils.image.load('images/BackGround6_1.png');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user