current weather scroll in html

This commit is contained in:
Matt Walsh 2022-08-04 13:49:53 -05:00
parent 6ad9b86abc
commit 037499dfb1
7 changed files with 33 additions and 11 deletions

View file

@ -1,4 +1,4 @@
/* globals draw, navigation */
/* globals draw, navigation, utils */
// eslint-disable-next-line no-unused-vars
const currentWeatherScroll = (() => {
@ -14,10 +14,8 @@ const currentWeatherScroll = (() => {
// start drawing conditions
// reset starts from the first item in the text scroll list
const start = (_context) => {
// see if there is a context available
if (!_context) return;
// store see if the context is new
if (_context !== context) {
if (context && _context !== context) {
// clean the outgoing context
cleanLastContext();
// store the new blank context
@ -42,6 +40,7 @@ const currentWeatherScroll = (() => {
};
const cleanLastContext = () => {
if (!context) return;
if (blankDrawArea) context.putImageData(blankDrawArea, 0, 405);
blankDrawArea = undefined;
context = undefined;
@ -62,7 +61,7 @@ const currentWeatherScroll = (() => {
if (!data) return;
// clean up any old text
context.putImageData(blankDrawArea, 0, 405);
if (context) context.putImageData(blankDrawArea, 0, 405);
drawCondition(screens[screenIndex](data));
};
@ -70,7 +69,7 @@ const currentWeatherScroll = (() => {
// the "screens" are stored in an array for easy addition and removal
const screens = [
// station name
(data) => `Conditions at ${data.station.properties.name.substr(0, 20)}`,
(data) => `Conditions at ${utils.string.locationCleanup(data.station.properties.name).substr(0, 20)}`,
// temperature
(data) => {
@ -109,7 +108,14 @@ const currentWeatherScroll = (() => {
// internal draw function with preset parameters
const drawCondition = (text) => {
if (context) {
draw.text(context, 'Star4000', '24pt', '#ffffff', 70, 430, text, 2);
}
// update all html scroll elements
utils.elem.forEach('.weather-display .scroll .fixed', (elem) => {
elem.innerHTML = text;
});
};
// return the api

View file

@ -169,7 +169,6 @@ class WeatherDisplay {
// if (_ScrollText !== '') OkToDrawCustomScrollText = true;
if (this.elemId === 'almanac') OkToDrawNoaaImage = false;
if (this.elemId === 'travelForecast') OkToDrawNoaaImage = false;
if (this.elemId === 'hourly') OkToDrawNoaaImage = false;
if (this.elemId === 'regionalForecast') OkToDrawNoaaImage = false;
if (this.elemId === 'progress') {
OkToDrawCurrentConditions = false;

View file

@ -89,11 +89,20 @@
width: calc(100% - 128px);
}
.weather-display .scroll {
/* eventually, when chrome supports paint-order for html elements */
/* -webkit-text-stroke: 2px black; */
/* paint-order: stroke fill; */
text-shadow: 3px 3px 0 black, -1.5px -1.5px 0 black, 0 -1.5px 0 black, 1.5px -1.5px 0 black, 1.5px 0 0 black, 1.5px 1.5px 0 black, 0 1.5px 0 black, -1.5px 1.5px 0 black, -1.5px 0 0 black;
width: 640px;
height: 80px;
overflow: hidden;
margin-top: 10px;
}
.weather-display .scroll .fixed {
font-family: "Star4000";
font-size: 24pt;
margin-left: 55px;
}
.weather-display .main.hourly.main {
overflow-y: hidden;

View file

@ -1 +1 @@
{"version":3,"sources":["scss/_weatherdisplay.scss","compiled.css","scss/_colors.scss","scss/_utils.scss","scss/_hourly.scss","scss/_current-weather.scss","scss/_local-forecast.scss","scss/_latest-observations.scss"],"names":[],"mappings":"AAGA;EACC,YAAA;EACA,aAAA;EACA,gBAAA;EACA,kBAAA;EACA,kDAAA;EAEA,oFAAA;EACA,WAAA;ACHD;ADKC;EACC,aAAA;ACHF;ADMC;EACC,aAAA;ACJF;ADOC;EACC,YAAA;EACA,YAAA;EACA,iBAAA;ACLF;ADOE;EACC,aE3BW;ECGb,mEAAA;EACA,oCAAA;EACA,8BAAA;EACA,0LACC;EHsBC,uBAAA;EACA,eAAA;EACA,kBAAA;ACFH;ADIG;EACC,WAAA;EACA,SAAA;ACFJ;ADKG;EACC,WAAA;ACHJ;ADKI;EACC,kBAAA;ACHL;ADMI;EACC,SAAA;ACJL;ADOI;EACC,SAAA;ACLL;ADWE;EACC,SAAA;EACA,UAAA;EACA,kBAAA;EACA,WAAA;ACTH;ADYE;EACC,kBAAA;EACA,SAAA;EACA,WAAA;ACVH;ADaE;EACC,SAAA;ACXH;ADcE;EACC,gBAAA;EACA,YE1ES;EF2ET,6BAAA;EACA,eAAA;EG1EF,mEAAA;EACA,oCAAA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;ANqQJ;AMnQI;EACC,kBAAA;EACA,QAAA;ANqQL;AMlQI;EACC,gBAAA;EACA,iBAAA;ANoQL","file":"compiled.css"}
{"version":3,"sources":["scss/_weatherdisplay.scss","compiled.css","scss/_colors.scss","scss/_utils.scss","scss/_hourly.scss","scss/_current-weather.scss","scss/_local-forecast.scss","scss/_latest-observations.scss"],"names":[],"mappings":"AAGA;EACC,YAAA;EACA,aAAA;EACA,gBAAA;EACA,kBAAA;EACA,kDAAA;EAEA,oFAAA;EACA,WAAA;ACHD;ADKC;EACC,aAAA;ACHF;ADMC;EACC,aAAA;ACJF;ADOC;EACC,YAAA;EACA,YAAA;EACA,iBAAA;ACLF;ADOE;EACC,aE3BW;ECGb,mEAAA;EACA,oCAAA;EACA,8BAAA;EACA,0LACC;EHsBC,uBAAA;EACA,eAAA;EACA,kBAAA;ACFH;ADIG;EACC,WAAA;EACA,SAAA;ACFJ;ADKG;EACC,WAAA;ACHJ;ADKI;EACC,kBAAA;ACHL;ADMI;EACC,SAAA;ACJL;ADOI;EACC,SAAA;ACLL;ADWE;EACC,SAAA;EACA,UAAA;EACA,kBAAA;EACA,WAAA;ACTH;ADYE;EACC,kBAAA;EACA,SAAA;EACA,WAAA;ACVH;ADaE;EACC,SAAA;ACXH;ADcE;EACC,gBAAA;EACA,YE1ES;EF2ET,6BAAA;EACA,eAAA;EG1EF,mEAAA;EACA,oCAAA;EACA,8BAAA;EACA,0LACC;EHwEC,WAAA;EACA,YAAA;EACA,iBAAA;EACA,kBAAA;ACTH;ADWG;EACC,iBAAA;ACTJ;ADcC;EACC,kBAAA;ACZF;ADcE;EACC,YAAA;EACA,aAAA;EACA,gBAAA;ACZH;ADeE;EACC,iBAAA;EACA,kBAAA;EACA,yBAAA;ACbH;ADmBC;EGzGA,mEAAA;EACA,oCAAA;EACA,8BAAA;EACA,0LACC;EHuGA,YAAA;EACA,YAAA;EACA,gBAAA;EACA,gBAAA;ACdF;ADgBE;EACC,uBAAA;EACA,eAAA;EACA,i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rKG;EACC,gBAAA;AJuKJ;AInKE;EACC,mBAAA;AJqKH;AInKG;EACC,UAAA;EACA,qBAAA;EACA,WAAA;AJqKJ;AIlKG;EACC,gBAAA;AJoKJ;AIjKG;EACC,iBAAA;AJmKJ;AI/JE;EACC,gBAAA;AJiKH;AI9JE;EACC,aH3FW;EG4FX,mBAAA;AJgKH;;AKxPC;EACC,kBAAA;EACA,SAAA;EACA,gBAAA;EACA,sBAAA;EACA,aAAA;EACA,gBAAA;AL2PF;AKxPC;EACC,kBAAA;AL0PF;AKvPC;EACC,uBAAA;EACA,eAAA;EACA,yBAAA;EHjBD,mEAAA;EACA,oCAAA;EACA,8BAAA;EACA,0LACC;EGeA,iBAAA;EACA,iBAAA;AL4PF;;AM9QC;EACC,kBAAA;ANiRF;AM/QE;EACC,YAAA;EACA,kBAAA;EACA,WAAA;ANiRH;AM9QE;EACC,QAAA;ANgRH;AM9QG;EACC,qBAAA;EACA,6BAAA;EACA,eAAA;EACA,kBAAA;EACA,UAAA;EJnBH,mEAAA;EACA,oCAAA;EACA,8BAAA;EACA,0LACC;AFmSF;AMhRG;EAEC,aAAA;ANiRJ;AM/QI;EACC,qBAAA;ANiRL;AM5QE;EACC,WAAA;AN8QH;AM3QE;EACC,WAAA;AN6QH;AM1QE;EACC,WAAA;AN4QH;AMzQE;EACC,iBAAA;EACA,iBAAA;AN2QH;AMzQG;EACC,uBAAA;EACA,eAAA;EJnDH,mEAAA;EACA,oCAAA;EACA,8BAAA;EACA,0LACC;EIiDE,kBAAA;EACA,YAAA;AN8QJ;AM5QI;EACC,kBAAA;EACA,QAAA;AN8QL;AM3QI;EACC,gBAAA;EACA,iBAAA;AN6QL","file":"compiled.css"}

View file

@ -107,9 +107,16 @@
.scroll {
@include u.text-shadow(3px, 1.5px);
width: 640px;
height: 80px;
overflow: hidden;
margin-top: 10px;
.fixed {
font-family: 'Star4000';
font-size: 24pt;
margin-left: 55px;
}
}
}

View file

@ -93,7 +93,7 @@
<div id="hourly-html" class="weather-display">
<%- include('partials/hourly.ejs') %>
</div>
<div id="current-weather-html" class="weather-display">
<div id="current-weather-html" class="weather-display show">
<%- include('partials/current-weather.ejs') %>
</div>
<div id="local-forecast-html" class="weather-display">

View file

@ -1,3 +1,4 @@
<div class="scroll">
Scroll
<div class="scrolling template"></div>
<div class="fixed"></div>
</div>