# Inspector without overlay resize the canvas

**URL:** <https://forum.babylonjs.com/t/inspector-without-overlay-resize-the-canvas/3800>\
**Category:** Bugs\
**Created:** [June 11, 2019, 12:56am UTC](https://forum.babylonjs.com/t/inspector-without-overlay-resize-the-canvas/3800 "2019-06-11T00:56:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [June 11, 2019, 12:56am UTC](https://forum.babylonjs.com/t/inspector-without-overlay-resize-the-canvas/3800/1 "2019-06-11T00:56:48Z")

</div>

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.)

 ![capure1](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/a/a7780781faf35adf178dfcfd75173506c2dfecc1.jpeg)

**with overlay**

 ![capture2](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/a/a3b092c8b1ff46069edb67bf3c4fa4f687f6d284.jpeg)

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>
```

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [June 11, 2019, 2:20am UTC](https://forum.babylonjs.com/t/inspector-without-overlay-resize-the-canvas/3800/2 "2019-06-11T02:20:50Z")

</div>

Hi D72, good to see you again.

I noticed that the canvas _height_ ATTRIBUTE (not CSS style height)… changes from 960px+… to around 660px… after the debug layer show. (Seen via Firefox document Inspector in f12 dev tools).

Although there still may be problems in the non-playground debug layer, YOUR issue can be “worked-around” like this:

```
scene.onAfterRenderObservable.add(function(){
	canvas.setAttribute("height", "1000px");
});

```

I added it AFTER the debug-show, but it probably doesn’t matter. That worked for me, and it might help us find the issue/bug.

Update: If I add height=225 to the canvas element (an attribute… so not inside the STYLE quotes)… that also works (for me, at my screen resolution). Strange. [d72test01.zip (1.4 KB)](https://forum.babylonjs.com/uploads/short-url/a3ZottdTQwYp8fZpzR1euA2G9xR.zip)

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [June 11, 2019, 10:50am UTC](https://forum.babylonjs.com/t/inspector-without-overlay-resize-the-canvas/3800/3 "2019-06-11T10:50:14Z")

</div>

Hi Wingnut,

I come every day to follow Babylon, but I do not post much more lately.

So that the problem does not appear, I use:

`scene.debugLayer.show({handleResize: true, overlay: true});`

But if I use this:

`scene.debugLayer.show();`

The problem appears. But I see that in the Playground, this problem does not appear in this way.

I feel that the inspector is sizing according to the elements it contains on the right without using the option `overlay: true`

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [June 11, 2019, 12:44pm UTC](https://forum.babylonjs.com/t/inspector-without-overlay-resize-the-canvas/3800/4 "2019-06-11T12:44:08Z")

</div>

In fact, I understood why. It is necessary that :

```
html, body {
        width: 100%;
        height: 100%;
}

```

If I do

```
   body {
            width: 100%;
            height: 100%;
    }

```

I have the error. I must also put it for the tag \< html\> and the error disappears.

Problem solved. Careless mistake.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [June 11, 2019, 1:57pm UTC](https://forum.babylonjs.com/t/inspector-without-overlay-resize-the-canvas/3800/5 "2019-06-11T13:57:15Z")

</div>

No worries! Thanks for sharing your finding (and welcome back! long time no see :))

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [June 11, 2019, 2:07pm UTC](https://forum.babylonjs.com/t/inspector-without-overlay-resize-the-canvas/3800/6 "2019-06-11T14:07:41Z")

</div>

Indeed. I come regularly anyway. I will never let go of Babylon who is “généalissime”.
