HiDPI support -- fractional scaling is a bit broken, sometimes crashes, is a bit blurry

This commit is contained in:
2026-03-25 23:32:08 +01:00
parent e8867e4b01
commit 103f17b8e9
6 changed files with 94 additions and 9 deletions

View File

@@ -48,12 +48,13 @@
setStatus: function(text) {
document.getElementById('status').textContent = text;
},
// Auto-resize canvas to fill the window.
// Auto-resize canvas at full device resolution.
preRun: [function() {
function resize() {
var canvas = document.getElementById('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var dpr = window.devicePixelRatio || 1;
canvas.width = Math.round(window.innerWidth * dpr);
canvas.height = Math.round(window.innerHeight * dpr);
}
resize();
window.addEventListener('resize', resize);