Strangely enough, that works the first time it displays, then after you
resize it again, the circle is way off the bottom right edge of the screen.
Not sure what's going on... I'm using lps-3.2. 

        -Don


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Don Hopkins
Sent: Sunday, June 11, 2006 2:23 PM
To: 'Sarah Allen'; [EMAIL PROTECTED]
Cc: 'Adam Wolff'; 'OpenLaszlo development and bug reporting'
Subject: Re: [Laszlo-dev] implementing non-rectangular masks in LZX

Here's a simplified version of what I got to work, which now that I look at
it is a wee bit more complicated that I remembered. You have to redraw the
shape whenever the size changes! This code tries to be lazy about that, only
resizing once after both the width and height change. 

        -Don


<canvas
  width="100%"
  height="100%"
  proxied="false"
>

  <drawview
    id="myFrame"
    width="${parent.width}"
    height="${parent.height}"
  >


    <attribute name="setSizeLaterDelegate" value="$once{new LzDelegate(this,
'setSizeLater')}"/>
    <attribute name="setSizeLaterDelegateTriggered" value="false"/>
    

    <method name="invalidateSize"><![CDATA[
        if (this.setSizeLaterDelegateTriggered) {
          return;
        }
        LzIdle.callOnIdle(this.setSizeLaterDelegate);
        this.setSizeLaterDelegateTriggered = true;
      ]]>
    </method>


    <method name="setSizeLater"><![CDATA[
        Debug.write("setSizeLater", this, this.width, this.height);
        this.setSizeLaterDelegateTriggered = false;
        this.setSizeNow();
      ]]>
    </method>


    <method name="setSizeNow"><![CDATA[
Debug.write("frame setSizeNow", this);
        var width = this.width;
        var height = this.height;
        this.clearMask();
        this.oval(
          width / 2,
          height / 2,
          width / 2,
          height / 2);
        this.clip();
      ]]>
    </method>


    <method event="onwidth"><![CDATA[
        this.invalidateSize();
      ]]>
    </method>


    <method event="onheight"><![CDATA[
        this.invalidateSize();
      ]]>
    </method>


    <view id="yellowThing" 
      width="${parent.width}"
      height="${parent.height}"
      bgcolor="0xffff00"
    />


  </drawview>

</canvas>



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


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

Reply via email to