Name

resizestate — A standard resize behavior.

Synopsis

LZX: resizestate
JavaScript: resizestate
Type: Class
Access: public
Topic: Components.States
Declared in: lps/components/utils/states/resizestate.lzx

Description

resizestate can be used to change the width and height of a view in response to the movement of the mouse.

In the example below, the resizestate tracks differences in the mouse position from after it is applied, so the bottom right corner of the resizing view does not snap to the mouse position.

Example 56. Resizing a view using the mouse

            <canvas height="120">
              <view bgcolor="green" width="100" height="100"
                    onmousedown="rs.apply()" onmouseup="rs.remove()">
                <resizestate name="rs"/>
              </view>
            </canvas>
            

resizes its immediateparent in response to mouse events, when applied

Superclass Chain

node (LzNode) » state (LzState) » resizestate

Known Subclasses

Details

Properties (4)

height
<attribute name="height" value="${this.immediateparent.getMouse( 'y' )- yroffset}" />
public var height;
width
<attribute name="width" value="${this.immediateparent.getMouse( 'x' )- xroffset}" />
public var width;
xroffset
<attribute name="xroffset" value="this.x - this.width + this.getMouse( 'x' )" />
public var xroffset;
the x offset from the mouse
yroffset
<attribute name="yroffset" value="this.y - this.height + this.getMouse( 'y' )" />
public var yroffset;
the y offset from the mouse

LZX Synopsis

<class name="resizestate" extends=" LzState ">
  <attribute name=" height " value="${this.immediateparent.getMouse( 'y' )- yroffset}" />
  <attribute name=" width " value="${this.immediateparent.getMouse( 'x' )- xroffset}" />
  <attribute name=" xroffset " value="this.x - this.width + this.getMouse( 'x' )" />
  <attribute name=" yroffset " value="this.y - this.height + this.getMouse( 'y' )" />
</class>

JavaScript Synopsis

public resizestate extends  LzState  {
  public var height ;
  public var width ;
  public var xroffset ;
  public var yroffset ;
}