Author: max
Date: 2007-09-26 18:41:06 -0700 (Wed, 26 Sep 2007)
New Revision: 6630

Modified:
   openlaszlo/trunk/lps/components/extensions/drawview.lzx
   openlaszlo/trunk/lps/components/incubator/roundrect.lzx
Log:
Change 20070925-maxcarlson-3 by [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
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.



Modified: openlaszlo/trunk/lps/components/extensions/drawview.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/drawview.lzx     2007-09-27 
01:20:14 UTC (rev 6629)
+++ openlaszlo/trunk/lps/components/extensions/drawview.lzx     2007-09-27 
01:41:06 UTC (rev 6630)
@@ -287,6 +287,25 @@
                 if (drawview.prototype.uid == null) {
                     drawview.prototype.uid = 0;
                 }
+                this.beginPath();
+    
+                if (this.__LZcanvas) {
+                    this._lineWidth = null;
+                    this._lineCap = null;
+                    this._fillStyle = null;
+                    this._strokeStyle = null;
+                    this._globalAlpha = null;
+                    if (Lz.__BrowserDetect.isIE) {
+                        LzSprite.prototype.__discardElement(this.__LZcanvas);
+                    } else {
+                        this.__LZcanvas.setAttribute('width', width);
+                        this.__LZcanvas.setAttribute('height', height);
+                        this.__canvaswidth = width;
+                        this.__canvasheight = height;
+                        this.setAttribute('context', 
this.__LZcanvas.getContext("2d"));
+                        return;
+                    }
+                }
                 this.__id = 'canvas-' + drawview.prototype.uid++;
                 //Debug.write('_buildcanvas', this.__id, width, height);
     
@@ -298,7 +317,6 @@
                 this.__canvasheight = height;
                 var div = this.getMCRef();
                 div.appendChild(this.__LZcanvas);
-                this.beginPath();
     
                 if (Lz.__BrowserDetect.isIE) {
                     // IE can take a while to start up.
@@ -310,13 +328,13 @@
             }
             function setWidth(w) {
                 super.setWidth(w);
-                if (this['__id'] == null && this.height > 0) {
+                if (this.height > 0) {
                     this._buildcanvas(w, this.height);
                 }
             }
             function setHeight(h) {
                 super.setHeight(h);
-                if (this['__id'] == null && this.width > 0) {
+                if (this.width > 0) {
                     this._buildcanvas(this.width, h);
                 }
             }

Modified: openlaszlo/trunk/lps/components/incubator/roundrect.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/roundrect.lzx     2007-09-27 
01:20:14 UTC (rev 6629)
+++ openlaszlo/trunk/lps/components/incubator/roundrect.lzx     2007-09-27 
01:41:06 UTC (rev 6630)
@@ -168,6 +168,7 @@
         <handler name="oncontext">
             <![CDATA[
             this.drawStructure();
+            this._cache = null;
             ]]>
         </handler>
 
@@ -193,7 +194,7 @@
                     ,insettop: this.insettop
                     ,insetright: this.insetright
                     ,insetbottom: this.insetbottom
-                    ,inset: this.inset
+                    ,inset: this['inset']
                     ,height: this.height
                     ,width: this.width
                 };


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to