Private
Public Access
1
0

add togglePresentationMode_WASM: enable F1 key handling, refine CSS styles, and adjust asset scaling logic
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 1m41s

This commit is contained in:
Sebastian Unterschütz
2026-04-22 20:44:31 +02:00
parent e7609dc50e
commit be76d025da
3 changed files with 68 additions and 15 deletions

View File

@@ -729,6 +729,14 @@ document.addEventListener('keydown', (e) => {
showMenu();
gameStarted = false;
}
// F1 to toggle presentation mode
if (e.key === 'F1') {
e.preventDefault();
if (window.togglePresentationMode_WASM) {
window.togglePresentationMode_WASM();
}
}
});
// Show Game Over Screen (called by WASM)
@@ -986,10 +994,17 @@ async function spawnPresiAsset() {
const img = document.createElement('img');
img.src = `assets/${def.Filename || 'playernew.png'}`;
// Scale based on JSON and screen height
// Base scale from JSON
const baseScale = def.Scale || 1.0;
const responsiveScale = (window.innerHeight / 720) * 3.0; // scale up for presentation
img.style.transform = `scale(${baseScale * responsiveScale})`;
// We want the asset to have a certain base size in the track, scaled by its individual Scale factor
const trackHeight = 150;
const targetSize = trackHeight * 0.6; // target 60% of track height
img.style.height = `${targetSize}px`;
img.style.width = 'auto';
img.style.transform = `scale(${baseScale * 4.0})`; // Individual scale adjustment
img.style.transformOrigin = 'bottom center';
el.appendChild(img);
track.appendChild(el);