I have a simple html page, with just a < canvas> in the < body>. No other HTML code.
My < canvas> and my < body> are 100% Width and Height.
But when I use debugLayer, it redimposes the canvas.
I have to use the overlay: true option to make it work properly. But when I look on the PG, I do not get this problem, I guess the PG has more than just a HTML page like I did.
That’s what I have in picture witout overlay (At the bottom of the image the canvas is no longer full page.)
with overlay
I do not reproduce it on the Playground, but I did nothing extraordinary on my html page. (a cube and the debuglayer in a simple html page)
Here is the code I wrote :
< body style="width: 100%; height: 100%; padding: 0; margin: 0; overflow: hidden;">
< canvas id="canvas" style="width: 100%; height: 100%; padding: 0; margin: 0; overflow: hidden;"></canvas>
< script>
var canvas = document.getElementById("canvas");
var engine = new BABYLON.Engine(canvas, true, {preserveDrawingBuffer: true, stencil: true});
engine.enableOfflineSupport = false;
window.addEventListener("resize", () => {
engine.resize();
});
var scene = new BABYLON.Scene(engine, {useGeometryIdsMap: true, useClonedMeshhMap: true, useMaterialMeshMap: true});
scene.shadowsEnabled = true;
scene.autoClear = true;
//scene.hoverCursor = "";
scene.ambientColor = new BABYLON.Color3(0.33, 0.33, 0.33);
scene.clearColor = new BABYLON.Color3(0.85, 0.85, 0.85);
var hemisphericLight = new BABYLON.HemisphericLight("hemisphericLight", new BABYLON.Vector3(0, 1, 0), scene);
hemisphericLight.intensity = 1.0;
var camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0, 5, -10), scene);
camera.attachControl(canvas, true);
scene.cameraToUseForPointers = camera;
camera.applyGravity = false;
camera.ellipsoid = null;
camera.keysUp.push(90); // Z
camera.keysLeft.push(81); // Q
camera.keysDown.push(83); // S
camera.keysRight.push(68); // D
camera.minZ = 0;
camera.maxZ = 6000;
camera.speed = 0.5;
scene.activeCamera = camera;
var mesh = BABYLON.Mesh.CreateBox(name, 1.0, scene, false);
var material = new BABYLON.StandardMaterial("StandardMaterial", scene);
material.diffuseColor = new BABYLON.Color4(0, 1, 0, 1);
mesh.material = material;
engine.runRenderLoop(() => {
scene.render();
});
scene.debugLayer.show();
</script>