Refactor alert/hazard system with timing and display improvements

- Replace magic numbers with seconds-based timing constants
- Switch from scrollTo() to hardware-accelerated transform
- Add scroll caching to prevent repeated DOM queries every scroll cycle
- Switch to safeJson() for centralized error handling across alert modules
- Horizontal alert scroll now goes edge-to-edge
- Integrate global speed settings into horizontal scroll timing
- Improve error handling flow with better fallback behavior for missing data
- Remvoe unused getCurrentData() function in hazards.mjs
- Move background color from scrolling element to container to avoid
    showing the underlying content when scrolling with trasnform
This commit is contained in:
Eddy G
2025-06-24 23:41:44 -04:00
parent e34137e430
commit bec80a1ebe
4 changed files with 121 additions and 64 deletions

View File

@@ -1,17 +1,16 @@
@use 'shared/_colors'as c;
@use 'shared/_utils'as u;
@use 'shared/_colors' as c;
@use 'shared/_utils' as u;
.weather-display .main.hazards {
&.main {
overflow-y: hidden;
height: 480px;
background-color: rgb(112, 35, 35);
.hazard-lines {
min-height: 400px;
padding-top: 10px;
background-color: rgb(112, 35, 35);
.hazard {
font-family: 'Star4000';
font-size: 24pt;
@@ -26,4 +25,4 @@
}
}
}
}
}

View File

@@ -1,5 +1,5 @@
@use 'shared/_colors'as c;
@use 'shared/_utils'as u;
@use 'shared/_colors' as c;
@use 'shared/_utils' as u;
.weather-display {
width: 640px;
@@ -129,6 +129,12 @@
overflow: hidden;
}
// Remove margins for hazard scrolls to maximize text space
&.hazard .fixed {
margin-left: 0;
margin-right: 0;
}
.scroll-header {
height: 26px;
font-family: "Star4000 Small";
@@ -150,4 +156,4 @@
}
}
}
}