wasm: improve HiDPI support

This commit is contained in:
2026-03-27 00:50:50 +01:00
parent 4e102fc31e
commit 74e1c34446
3 changed files with 83 additions and 18 deletions

View File

@@ -48,17 +48,9 @@
setStatus: function(text) {
document.getElementById('status').textContent = text;
},
// Auto-resize canvas at full device resolution.
preRun: [function() {
function resize() {
var canvas = document.getElementById('canvas');
var dpr = window.devicePixelRatio || 1;
canvas.width = Math.round(window.innerWidth * dpr);
canvas.height = Math.round(window.innerHeight * dpr);
}
resize();
window.addEventListener('resize', resize);
}]
// Canvas backing-store sizing is handled in C++ via syncCanvasSize()
// each frame, so no JS resize handler is needed.
preRun: []
};
</script>
{{{ SCRIPT }}}