navigation buttons fix

This commit is contained in:
2026-03-20 12:53:32 +01:00
parent 8e034f30ef
commit f2f36ec989
3 changed files with 71 additions and 30 deletions

View File

@@ -101,10 +101,51 @@
ctx.stroke();
}
// Draw static hex grid for mobile (no animation)
function initMobileStatic() {
const c = document.getElementById('hexCanvas');
if (!c) return;
const dpr = Math.min(window.devicePixelRatio || 1, 2);
const w = window.innerWidth;
const h = window.innerHeight;
c.width = w * dpr;
c.height = h * dpr;
c.style.width = w + 'px';
c.style.height = h + 'px';
const cx = c.getContext('2d');
cx.scale(dpr, dpr);
cx.strokeStyle = 'rgba(119,119,100,0.15)';
cx.lineWidth = 1;
const size = 30;
const hs = size * Math.sqrt(3);
const vs = size * 1.5;
const cols = Math.ceil(w / hs) + 2;
const rows = Math.ceil(h / vs) + 2;
for (let row = -1; row < rows; row++) {
for (let col = -1; col < cols; col++) {
const xOff = (row % 2 === 1) ? hs / 2 : 0;
const x = col * hs + xOff;
const y = row * vs;
cx.beginPath();
for (let i = 0; i < 6; i++) {
const angle = (Math.PI / 3) * i - Math.PI / 2;
const px = x + size * Math.cos(angle);
const py = y + size * Math.sin(angle);
i === 0 ? cx.moveTo(px, py) : cx.lineTo(px, py);
}
cx.closePath();
cx.stroke();
}
}
}
// Initialize
function init() {
// Skip animation on mobile/touch devices for performance
if (window.innerWidth <= 768 || ('ontouchstart' in window)) return;
// On mobile/touch: draw static hex pattern only, no animation
if (window.innerWidth <= 768 || ('ontouchstart' in window)) {
initMobileStatic();
return;
}
canvas = document.getElementById('hexCanvas');
if (!canvas) return;