There was no response several months ago and now I'm just getting back
to this part of my code and noticed different behavior in 4.2b2 and
stumbled across a "workaround".
The different behavior is that the drawview no longer resizes at all,
neither expanding nor shrinking, whereas before it would expand.
The workaround is to set the width and height to null before drawing.
Insert these lines before "redlight.clear();":
redlight.setAttribute('width', null);
redlight.setAttribute('height', null);
The drawview will both expand and shrink.
There is a problem with this workaround, however, when drawing does
not touch all the edges of the view, e.g. a 1 pixel line from (0,20)
to (20,20) results in a width of 20 and height 1 (should be 20). This
is "fixed", oddly enough, by including a subview to the drawview.
On Wed, Sep 24, 2008 at 5:24 PM, Greg Denton <[EMAIL PROTECTED]> wrote:
> drawview seems to resize larger but not smaller. Is this by design?
>
> There is a bug reported fixed, but its test case only does a one shot draw.
> http://www.openlaszlo.org/jira/browse/LPP-4836
>
> Here is a test case for changing drawing size based on the one in the
> bug report:
>
> <canvas debug="true">
> <view name="trafficlight_container"
> bgcolor="yellow" >
> <attribute name="rad" type="number" value="50"/>
> <handler name="oninit">
> drawCircle();
> </handler>
> <method name="drawCircle" args="dv">
> redlight.clear();
> redlight.beginPath();
> var r = this.rad;
> redlight.arc(r,r,r,0,360);
> redlight.fillStyle = red;
> redlight.fill();
> </method>
> <simplelayout axis="y" spacing="0"/>
> <text>This should be *above* the redlight</text>
> <drawview name="redlight" />
> <text>This should be *below* the redlight</text>
> <button text="shrink"
> onclick="parent.rad = parent.rad / 2; parent.drawCircle();"/>
> <button text="expand"
> onclick="parent.rad += parent.rad; parent.drawCircle();"/>
> </view>
> </canvas>
>
> Running:
> proxied, compiled for swf 8
> lps 4.2 beta 1, linux centos 5.2
> foxfire 2.0 linux & 3.0 windows, swf 9
>
> Thanks.
>