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
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 1m41s
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user