Fix pointer position in hidpi-corrected resolutions on web
This commit is contained in:
Vendored
+7
-2
@@ -162,8 +162,13 @@ $GODOT_HEAD_INCLUDE
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
function adjustCanvasDimensions() {
|
||||
canvas.width = innerWidth;
|
||||
canvas.height = innerHeight;
|
||||
var scale = window.devicePixelRatio || 1;
|
||||
var width = window.innerWidth;
|
||||
var height = window.innerHeight;
|
||||
canvas.width = width * scale;
|
||||
canvas.height = height * scale;
|
||||
canvas.style.width = width + "px";
|
||||
canvas.style.height = height + "px";
|
||||
}
|
||||
animationCallbacks.push(adjustCanvasDimensions);
|
||||
adjustCanvasDimensions();
|
||||
|
||||
Reference in New Issue
Block a user