[Laszlo-dev] For Review: Change 20070925-maxcarlson-3 Summary: Make drawviews resize.

André Bargull a.bargull at intensis.de
Sat Sep 29 07:11:24 PDT 2007


Not approved,
because WHATWG says HTML-<canvas> width/height must be "valid 
non-negative integers" 
("http://www.whatwg.org/specs/web-apps/current-work/#width3").
So we need to convert width/height to int before applying to the 
underlying <canvas> element.
In addition to that, we need to change CSS-"visibility" / "display" in 
case we want to set the drawview's width/height to 0,
because we do not allow zero values for "_buildcanvas(..)"
and in Firefox, zero-values for <canvas> width/height will be 
automatically changed to default-values!

Attached testcase.

Patch:
279,281c279,280
<                 var w = Math.floor(args ? args['width'] : this.width);
<                 var h = Math.floor(args ? args['height'] : this.height);
<                
---
 >                 var w = args ? args['width'] : this.width;
 >                 var h = args ? args['height'] : this.height;
302d300
<                         this.__LZcanvas.style.visibility = "visible";
333,340c331,332
<                 w = Math.floor(w);
<                 var h = Math.floor(this.height);
<                 if (h > 0 && w > 0) {
<                     this._buildcanvas(w, h);
<                 } else {
<                     if (this.__LZcanvas) {
<                         this.__LZcanvas.style.visibility = "hidden";
<                     }
---
 >                 if (this.height > 0) {
 >                     this._buildcanvas(w, this.height);
345,352c337,338
<                 var w = Math.floor(this.width);
<                 h = Math.floor(h);
<                 if (w > 0 && h > 0) {
<                     this._buildcanvas(w, h);
<                 } else {
<                     if (this.__LZcanvas) {
<                         this.__LZcanvas.style.visibility = "hidden";
<                     }
---
 >                 if (this.width > 0) {
 >                     this._buildcanvas(this.width, h);


Max Carlson wrote:
> Change 20070925-maxcarlson-3 by maxcarlson at plastik on 2007-09-25 
> 17:03:02 PDT
>     in /Users/maxcarlson/openlaszlo/trunk
>     for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: Make drawviews resize.
>
> New Features:
>
> Bugs Fixed: LPP-3905 - Changes on width/height must be propagated down 
> to the HTML-canvas in DHTML
>
> Technical Reviewer: promanik
> QA Reviewer: andrebargull at aol.com
> Doc Reviewer: (pending)
>
> Documentation: Drawviews now resize when the width or height are 
> changed.  In DHTML, the drawview will be cleared so it must be redrawn 
> whenever the oncanvas event is sent.
>
> Release Notes:
>
> Details: drawview.lzx - In _buildcanvas(), if the canvas exists it is 
> resized and the oncontext event is sent because it will be cleared.  
> For IE, the canvas must be completely destroyed and rebuilt.  
> setWidth() and setHeight() call _buildcanvas() whenever a valid height 
> and width are set.
>
> roundrect.lzx - Clear cached color state when oncontext is sent to 
> ensure canvas state is reset properly.
>
>
> Tests: 
> http://localhost:8080/trunk/lps/components/incubator/test/test-roundrectbutton.lzx?lzr=dhtml 
> now resizes beyond 100 pixels in IE and firefox.
>
> Files:
> M      lps/components/extensions/drawview.lzx
> M      lps/components/incubator/roundrect.lzx
>
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/20070925-maxcarlson-3.tar
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: LPP-3905_max.lzx
Url: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20070929/4d277304/LPP-3905_max-0001.pl


More information about the Laszlo-dev mailing list