Add responsive scaling; improve scanlines and Mobile Safari support

- Replace CSS zoom with CSS transform scaling for better mobile compatibility
- Implement wrapper-based scaling approach that includes both content and navigation bar
- Replace Almanac layout with CSS Grid for better cross-browser layout
- Greatly improve scanline algorithm to handle a wide variety of displays
- Add setting to override automatic scanlines to user-specified scale factor
- Remove scanline scaling debug functions
- Refactor settings module: initialize settings upfront and improve change handler declarations
- Enhance scanline SCSS with repeating-linear-gradient for better performance
- Add app icon for iOS/iPadOS
- Add 'fullscreen' event listener
- De-bounce 'resize' event listener
- Add 'orientationchange' event listener
- Implement three resize scaling algorithms:
  - Baseline (when no scaling is needed, like on the index page)
  - Mobile scaling (except Mobile Safari kiosk mode)
  - Mobile Safari kiosk mode (using manual offset calculations)
  - Standard fullscreen/kiosk mode (using CSS centering)
This commit is contained in:
Eddy G
2025-06-28 13:05:04 -04:00
parent cc9e613ba7
commit b49433f5ff
17 changed files with 797 additions and 1008 deletions

View File

@@ -83,10 +83,12 @@ $scan-opacity: .75;
bottom: 0;
left: 0;
z-index: $scan-z-index;
background: linear-gradient(to bottom,
transparent 50%,
$scan-color 51%);
background-size: 100% $scan-width*2;
// repeating-linear-gradient is more efficient than linear-gradient+background-size because it doesn't require the browser to calculate tiling
background: repeating-linear-gradient(to bottom,
transparent 0,
transparent $scan-width,
$scan-color $scan-width,
$scan-color calc($scan-width * 2));
@include scan-crt($scan-crt);
// Prevent sub-pixel aliasing on scaled displays
@@ -94,51 +96,21 @@ $scan-opacity: .75;
image-rendering: pixelated;
}
// Responsive scanlines for different display scenarios
// High DPI displays - use original sizing
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
&:before {
height: $scan-width;
}
&:after {
background-size: 100% calc($scan-width * 2);
}
// Scanlines use dynamic thickness calculated by JavaScript
// JavaScript calculates optimal thickness to prevent banding at any scale factor
// The --scanline-thickness custom property is set by applyScanlineScaling()
// The modes (hairline, thin, medium, thick) force the base thickness selection
// Some modes may appear the same (e.g. hairline and thin) depending on the display
&:before {
height: var(--scanline-thickness, $scan-width);
}
// Medium resolution displays (1024x768 and similar)
@media (max-width: 1200px) and (max-height: 900px) and (-webkit-max-device-pixel-ratio: 1.5) {
&:before {
height: calc($scan-width * 1.5);
}
&:after {
background-size: 100% calc($scan-width * 3);
}
}
// Low resolution displays - increase thickness to prevent banding
@media (max-width: 1024px) and (max-height: 768px) {
&:before {
height: calc($scan-width * 2);
}
&:after {
background-size: 100% calc($scan-width * 4);
}
}
// Very low resolution displays
@media (max-width: 800px) and (max-height: 600px) {
&:before {
height: calc($scan-width * 3);
}
&:after {
background-size: 100% calc($scan-width * 6);
}
&:after {
background: repeating-linear-gradient(to bottom,
transparent 0,
transparent var(--scanline-thickness, $scan-width),
$scan-color var(--scanline-thickness, $scan-width),
$scan-color calc(var(--scanline-thickness, $scan-width) * 2));
}
}