Forum

Zero Dimension with JSON loading

16 January 2016 20:07 #6616
this file is a working version with an older b4w.js

http://www.trepaning.com/b4w/workingB4W-JSONload.zip

this is essentially the same one but with the new JS

http://www.trepaning.com/b4w/wwwResize.7z

loading it causes a zero dimension warning and then resizes the canvas



I am curious as to where I am going wrong, if I am. Ignore other errors, they can be removed, I just wanted a reverted version to showcase issue.

Ultimately, help with a properly coded tester.js would also be appreciated to get up and running with JSON loading and object placement.
http://www.trepaning.com
18 January 2016 00:30 #6635
I am curious as to where I am going wrong, if I am. Ignore other errors, they can be removed, I just wanted a reverted version to showcase issue.

This error means that the canvas container element has zero width or height. You need to define non-zero dimensions by applying some css rules to the container. Set them as follows to make it fullscreen:
#canvas3d {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
}

This rules are set by default if you create your application via the Project Manager.

It worked before because the canvas could be resized to the browser window size regardless of the parent container element, which is quite confusing. Now the resizing is performed automatically by the engine and the size of the canvas is fully controlled by the container. Perhaps we should update our documentation or explain this situation more properly in the console message. Anyway, creating an application through the Project Manager (which is the most recommended way) hasn't this issue.
Blend4Web Team
18 January 2016 07:53 #6638
thanks for the info. I am up and running once again with JSON, until the next issue of course… :)
http://www.trepaning.com
 
Please register or log in to leave a reply.