[Resolved] CCEGLView:_setupContainer overides html <BODY> style -> causing padding issues

Hi
After a bit of searching I found that in CCEGLView, calling setDesignResolution would alter the style of

.

Tracing the “issue” i found out that *setupContainer overrides the body style with a padding of 0.
I saw this, as I use a padding-top of 60 so that my main content does not get under my fixed menu bar
Is this “normal”/intended or does this to be modified for other reasons ?
Thanks in advance.
Nicolas
@
*setupContainer:function(){
//…
var body = document.body;
if (body)
body.style.padding = body.style.border = body.style.margin = 0 + “px”;
//…
}@

Hi Nicolas,

The padding and other style were setup to make the canvas fit better the screen, but I agree that it shouldn’t overwrite user’s custom configuration. I will make some change to fix that for you.
Thank you for your feedback

Huabin

It has been fixed, please refer to : Avoid overwrite user’s custom body style

Thanks for checking and modiftying this guys!
Nicolas

Hi
just updated to the develop version with the modification.
The problem re-appeared: It is still overriding the body style.

I searched a bit and found out that the new code, works (ie does not overide body custom style) only for inline styles not styles in a css.

After a bit of research I found out that we must use : computedStyle.

to acces the style, looks like we must use something like that: (tried it works in Chrome and FireFox)

var body = document.getElementsByTagName(“body”);
var style = window.getComputedStyle(body[0], null);

Nicolas

oops
looks like it gets the ComputedStyle (which contains the CSS style) but it is read-only.
dunno what is the solution to overwrite the style attributes.

anyway hope it helps.

any idea on how to make that work with styles in CSS ?

Nicolas