Packagecom.yworks.canvas.input
Classpublic class RectangleHandle
InheritanceRectangleHandle Inheritance Object
Implements IMutablePoint, IMovable, IHandle

An IHandle implementation that modifies a rectangle.

Implementations of this class work on a mutable rectangle instance, which they use for both determining the position of the handle and for handling drags of the handle. As a convenience this class also implements the IMutablePoint and IMovable interface which both modify the handle's position.



Public Properties
 PropertyDefined By
  cursor : Cursor
[read-only] Provides the cursor to display when the mouse hovers over or drags this handle.
RectangleHandle
  type : uint
[read-only] Returns an appropriate type for this position.
RectangleHandle
  x : Number
The x coordinate of the position for this rectangle.
RectangleHandle
  y : Number
The y coordinate of the position for this rectangle.
RectangleHandle
Public Methods
 MethodDefined By
  
RectangleHandle(index:uint, location:IPoint, size:ISize, reshapable:IReshapeable)
This constructor should only be used by subclasses.
RectangleHandle
  
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
This implementation calls setPosition using the original values.
RectangleHandle
  
create(position:uint, location:IPoint, size:ISize, reshapable:IReshapeable):RectangleHandle
[static] Creates a handle for the given position that uses and modifies the given instances that are interpreted as a rectangle.
RectangleHandle
  
[static] Creates a handle for the given position that uses and modifies the rectangle instance provided.
RectangleHandle
  
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
This implementation does nothing.
RectangleHandle
  
handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
This implementation calls moveBy using the delta values.
RectangleHandle
  
This implementation does nothing.
RectangleHandle
  
moveBy(dx:Number, dy:Number):Boolean
Actually moves this handle by modifying the reshapeable.
RectangleHandle
  
moveByDx(dx:Number):Boolean
Moves in x direction.
RectangleHandle
  
moveByDy(dy:Number):Boolean
Moves in y direction.
RectangleHandle
  
setPosition(x:Number, y:Number):void
Sets the absolute position of the handle.
RectangleHandle
Property Detail
cursorproperty
cursor:Cursor  [read-only]

Provides the cursor to display when the mouse hovers over or drags this handle.


Implementation
    public function get cursor():Cursor
typeproperty 
type:uint  [read-only]

Returns an appropriate type for this position.


Implementation
    public function get type():uint
xproperty 
x:Number

The x coordinate of the position for this rectangle.


Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number

The y coordinate of the position for this rectangle.


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
RectangleHandle()Constructor
public function RectangleHandle(index:uint, location:IPoint, size:ISize, reshapable:IReshapeable)

This constructor should only be used by subclasses.

Parameters
index:uint — The index of the handle's position. 0 is north-west and 8 is south-east.
 
location:IPoint — The location of the upper left corner of the rectangle.
 
size:ISize — The size of the rectangle.
 
reshapable:IReshapeable — The reshapeable to write back the coordinates.
Method Detail
cancelDrag()method
public function cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void

This implementation calls setPosition using the original values.

Parameters

context:IInputModeContext — The context to work with.
 
originalX:Number — The original x coordinate.
 
originalY:Number — The original y coordinate.

create()method 
public static function create(position:uint, location:IPoint, size:ISize, reshapable:IReshapeable):RectangleHandle

Creates a handle for the given position that uses and modifies the given instances that are interpreted as a rectangle.

The implementation uses the location and size to model the rectangle and writes changes to the geometry of the rectangle to the reshapeable.

Parameters

position:uint — The position to use for the handle.
 
location:IPoint — The upper left corner of the rectangle.
 
size:ISize — The size of the rectangle.
 
reshapable:IReshapeable — The reshapeable to use for writing back changes of the handle.

Returns
RectangleHandle — A new instance that models a handle at the given position of the rectangle.

See also

createFromRectangle()method 
public static function createFromRectangle(position:uint, rect:IMutableRectangle):RectangleHandle

Creates a handle for the given position that uses and modifies the rectangle instance provided.

Parameters

position:uint — The position to use for the handle.
 
rect:IMutableRectangle — The rectangle that serves as a model for the handle.

Returns
RectangleHandle — A new instance that models a handle at the given position of the rectangle.

See also

dragFinished()method 
public function dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void

This implementation does nothing.

Parameters

context:IInputModeContext — The context to work with.
 
originalX:Number — The x coordinate before the drag operation started.
 
originalY:Number — The y coordinate before the drag operation started.
 
newX:Number — The new x coordinate.
 
newY:Number — The new y coordinate.

handleMove()method 
public function handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean

This implementation calls moveBy using the delta values.

Parameters

context:IInputModeContext — The context to work with.
 
originalX:Number — The x coordinate before the drag operation started.
 
originalY:Number — The y coordinate before the drag operation started.
 
newX:Number — The new x coordinate.
 
newY:Number — The new y coordinate.

Returns
Boolean
initializeDrag()method 
public function initializeDrag(context:IInputModeContext):void

This implementation does nothing.

Parameters

context:IInputModeContext — The context to work with.

moveBy()method 
public function moveBy(dx:Number, dy:Number):Boolean

Actually moves this handle by modifying the reshapeable.

Parameters

dx:Number — The x offset, the handle was moved by.
 
dy:Number — The y offset, the handle was moved by.

Returns
Boolean
moveByDx()method 
public function moveByDx(dx:Number):Boolean

Moves in x direction. Maps to moveBy

Parameters

dx:Number — The offset, the handle was moved by.

Returns
Boolean
moveByDy()method 
public function moveByDy(dy:Number):Boolean

Moves in y direction. Maps to moveBy

Parameters

dy:Number — The offset, the handle was moved by.

Returns
Boolean
setPosition()method 
public function setPosition(x:Number, y:Number):void

Sets the absolute position of the handle. Maps to moveBy

Parameters

x:Number — The x coordinate to set.
 
y:Number — The y coordinate to set.