summaryrefslogtreecommitdiff
path: root/misc/dist/html
diff options
context:
space:
mode:
Diffstat (limited to 'misc/dist/html')
-rw-r--r--misc/dist/html/fixed-size.html1
-rw-r--r--misc/dist/html/full-size.html29
2 files changed, 21 insertions, 9 deletions
diff --git a/misc/dist/html/fixed-size.html b/misc/dist/html/fixed-size.html
index a5633115d5..85064b34fd 100644
--- a/misc/dist/html/fixed-size.html
+++ b/misc/dist/html/fixed-size.html
@@ -236,7 +236,6 @@ $GODOT_HEAD_INCLUDE
const DEBUG_ENABLED = $GODOT_DEBUG_ENABLED;
const INDETERMINATE_STATUS_STEP_MS = 100;
- var container = document.getElementById('container');
var canvas = document.getElementById('canvas');
var statusProgress = document.getElementById('status-progress');
var statusProgressInner = document.getElementById('status-progress-inner');
diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html
index 435013cb5e..58cf8ba4d8 100644
--- a/misc/dist/html/full-size.html
+++ b/misc/dist/html/full-size.html
@@ -147,6 +147,7 @@ $GODOT_HEAD_INCLUDE
const MAIN_PACK = '$GODOT_BASENAME.pck';
const EXTRA_ARGS = JSON.parse('$GODOT_ARGS');
const INDETERMINATE_STATUS_STEP_MS = 100;
+ const FULL_WINDOW = $GODOT_FULL_WINDOW;
var canvas = document.getElementById('canvas');
var statusProgress = document.getElementById('status-progress');
@@ -156,6 +157,9 @@ $GODOT_HEAD_INCLUDE
var initializing = true;
var statusMode = 'hidden';
+ var lastWidth = 0;
+ var lastHeight = 0;
+ var lastScale = 0;
var animationCallbacks = [];
function animate(time) {
@@ -165,14 +169,23 @@ $GODOT_HEAD_INCLUDE
requestAnimationFrame(animate);
function adjustCanvasDimensions() {
- var scale = window.devicePixelRatio || 1;
- var width = window.innerWidth;
- var height = window.innerHeight;
- canvas.width = width * scale;
- canvas.height = height * scale;
+ const scale = window.devicePixelRatio || 1;
+ if (lastWidth != window.innerWidth || lastHeight != window.innerHeight || lastScale != scale) {
+ lastScale = scale;
+ lastWidth = window.innerWidth;
+ lastHeight = window.innerHeight;
+ canvas.width = Math.floor(lastWidth * scale);
+ canvas.height = Math.floor(lastHeight * scale);
+ canvas.style.width = lastWidth + "px";
+ canvas.style.height = lastHeight + "px";
+ }
+ }
+ if (FULL_WINDOW) {
+ animationCallbacks.push(adjustCanvasDimensions);
+ adjustCanvasDimensions();
+ } else {
+ engine.setCanvasResizedOnStart(true);
}
- animationCallbacks.push(adjustCanvasDimensions);
- adjustCanvasDimensions();
setStatusMode = function setStatusMode(mode) {
@@ -201,7 +214,7 @@ $GODOT_HEAD_INCLUDE
throw new Error('Invalid status mode');
}
statusMode = mode;
- }
+ };
function animateStatusIndeterminate(ms) {