View Full Version : Problem with canvas background when browser resized
rcyeager
01-14-2006, 10:51 AM
I have a canvas w/ 100% width and height settings. The HTML also sets the embedded Laszlo container w/ 100% width and height. I apply one of the color styles to give the canvas a background color.
If the browser is not maximized and the canvas is loaded, when the browser window is later maximized the canvas background paint does not resize...i.e. the background color doesn't fill in the new area.
The canvas width and height values ARE changed, however...so the canvas detected the browser resize event. The issue seems to be with the background color not repainting.
I saw another forum thread about this, but no solution was identified. Is there a workaround?
rcyeager
01-20-2006, 04:33 PM
So many people viewed my question, but no help?
http://book.orzar.net/ doesn't have this problem. I can see a laszlo scrollbar on the right side of the canvas hidden behind the browser scrollbar...it becomes visible when you drag the browser screen to resize...so maybe there is a trick involved in getting the background color to paint correctly?
rcyeager
01-20-2006, 04:38 PM
Here's the code, just run in a non-maximized browser and then resize the browser window a little bigger to see that the background doesn't fill in:
<canvas id="maincanvas" width="100%" height="100%" debug="true">
<debug x="850" y="200" width="600" height="300" fontsize="12"/>
<greenstyle name="greencolors"/>
<method event="oninit">
<![CDATA[
canvas['greencolors'].setAttribute("isdefault", true);
]]>
</method>
</canvas>
rcyeager
01-20-2006, 04:48 PM
I did some testing and found that setting the bgcolor of the canvas works OK:
<canvas id="maincanvas" width="100%" height="100%" debug="true" bgcolor="red">
<debug x="850" y="200" width="600" height="300" fontsize="12"/>
<greenstyle name="greencolors"/>
<method event="oninit">
<![CDATA[
maincanvas['greencolors'].setAttribute("isdefault", true);
]]>
</method>
</canvas>
In this test, the red background correctly paints when the browser is resized, but the green style background doesn't.
So I guess there is either a bug somewhere with the way styles are handled or I am doing something wrong?
rcyeager
01-20-2006, 07:59 PM
Placing a root view object that is sized to the canvas and contains all the other application views seems to do the trick. Basically the root view overlays the entire canvas and allows setting its bgcolor OK while resizing to the browser window.
Doesn't seem like this should be necessary, but if it works, it works.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.