[Laszlo-dev] How to make canvas adaptive on its size?
Raju Bitter
rajubitter at me.com
Sun Jun 21 02:10:34 PDT 2009
Just use percentage based values for width and height: <canvas
width="100%" height="100%" > That will scale the application to full
browser size. You can test the behavior for the HTML page if use ?
lzt=html as the query string. That will generate the default HTML
wrapper.
- Raju
On Jun 21, 2009, at 8:33 AM, Chen Ding wrote:
> Hi There,
>
> My application may increase its height. I like the canvas to adapt
> to my application's height. Below is a very simple application.
> Initially, the canvas height is the height of my browser. Since the
> view is only 500 pixels, it is ok initially. But if we press the
> button to increase the view size to 2000 pixels, the canvas won't
> increase its size accordingly. I tried to change canvas height but
> it won't work. I am wondering whether there is a way to make canvas
> adaptive to the size of the application.
>
> The second question is, if the canvas can be made adaptive to its
> application size, if I wrap the application into an HTML, will it
> still work?
>
>
> Thanks!
>
> Chen Ding
>
> 1 <canvas height="2000">
> 2 <view name="the_view" x="600" width="500" height="500"
> bgcolor="blue"/>
> 3
> 4 <button x="100" y="0" text="Increase">
> 5 <handler name="onclick">
> 6 the_view.setAttribute("height", "2000");
> 7 </handler>
> 8 </button>
> 9 </canvas>
>
More information about the Laszlo-dev
mailing list