Packagecom.yworks.canvas.input
Classpublic class ReshapeableHandle
InheritanceReshapeableHandle Inheritance Object
Implements IMutablePoint, IMovable, IHandle

A more sophisticated IHandle implementation that modifies a rectangle.

Implementations of this class work on a mutable rectangle instance for handling drags of the handle. A separate point implementation is used for specifying the position 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
Gets or sets the cursor to display when the mouse hovers over or drags this handle.
ReshapeableHandle
  maximumSize : ISize
Gets or sets the maximum size allowed for the reshapeable.
ReshapeableHandle
  minimumEnclosedArea : IRectangle
Gets or sets the minimum rectangular area that needs to be contained in the reshapeable.
ReshapeableHandle
  minimumSize : ISize
Gets or sets the minimum size allowed for the reshapeable.
ReshapeableHandle
  type : uint
Gets or sets the type of the handle that can be used by the rendering engine to render types differently.
ReshapeableHandle
  x : Number
Gets or sets the x coordinate.
ReshapeableHandle
  y : Number
Gets or sets the y coordinate.
ReshapeableHandle
Protected Properties
 PropertyDefined By
  index : uint
[read-only] The position of the handle.
ReshapeableHandle
  location : IPoint
[read-only] The reference for the location of the handle.
ReshapeableHandle
  rect : IRectangle
[read-only] The rectangle instance to modify.
ReshapeableHandle
  reshapeable : IReshapeable
[read-only] The reshapeable instance to write the changes to.
ReshapeableHandle
Public Methods
 MethodDefined By
  
ReshapeableHandle(index:uint, location:IPoint, rect:IRectangle, reshapeable:IReshapeable, minimumSize:ISize, maximumSize:ISize)
Constructor for subclasses that creates a handle for the given position using the location instance as the location for the handle.
ReshapeableHandle
  
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Delegates the original position to setPosition
ReshapeableHandle
  
create(position:uint, location:IPoint, rect:IRectangle, reshapeable:IReshapeable, minimumSize:ISize = null, maximumSize:ISize = null):ReshapeableHandle
[static] Creates a handle for the given position using the location instance as the position for the handle.
ReshapeableHandle
  
[static] Creates a handle for the given position that uses and modifies the rectangle instance provided.
ReshapeableHandle
  
[static] Creates a handle for the given position that uses and modifies the instances using the reshapeable interface.
ReshapeableHandle
  
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
This implementation does nothing.
ReshapeableHandle
  
handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
This implementation calls moveBy using the delta values.
ReshapeableHandle
  
This implementation does nothing.
ReshapeableHandle
  
moveBy(dx:Number, dy:Number):Boolean
Actually moves this handle by modifying the reshapeable.
ReshapeableHandle
  
moveByDx(dx:Number):Boolean
Moves in x direction.
ReshapeableHandle
  
moveByDy(dy:Number):Boolean
Moves in y direction.
ReshapeableHandle
  
setPosition(x:Number, y:Number):void
Sets the absolute position of the handle.
ReshapeableHandle
Property Detail
cursorproperty
cursor:Cursor

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


Implementation
    public function get cursor():Cursor
    public function set cursor(value:Cursor):void
indexproperty 
index:uint  [read-only]

The position of the handle. 0 for north-west up to 8 for south-east.


Implementation
    protected function get index():uint
locationproperty 
location:IPoint  [read-only]

The reference for the location of the handle.


Implementation
    protected function get location():IPoint
maximumSizeproperty 
maximumSize:ISize

Gets or sets the maximum size allowed for the reshapeable.

The value is stored by reference.

The default value is ImmutableSize.UNBOUND.


Implementation
    public function get maximumSize():ISize
    public function set maximumSize(value:ISize):void
minimumEnclosedAreaproperty 
minimumEnclosedArea:IRectangle

Gets or sets the minimum rectangular area that needs to be contained in the reshapeable.

The default value is ImmutableRectangle.EMPTY.


Implementation
    public function get minimumEnclosedArea():IRectangle
    public function set minimumEnclosedArea(value:IRectangle):void
minimumSizeproperty 
minimumSize:ISize

Gets or sets the minimum size allowed for the reshapeable.

The value is stored by reference.

The default value is ImmutableSize.EMPTY.


Implementation
    public function get minimumSize():ISize
    public function set minimumSize(value:ISize):void
rectproperty 
rect:IRectangle  [read-only]

The rectangle instance to modify.


Implementation
    protected function get rect():IRectangle
reshapeableproperty 
reshapeable:IReshapeable  [read-only]

The reshapeable instance to write the changes to.


Implementation
    protected function get reshapeable():IReshapeable
typeproperty 
type:uint

Gets or sets the type of the handle that can be used by the rendering engine to render types differently.


Implementation
    public function get type():uint
    public function set type(value:uint):void

See also

xproperty 
x:Number

Gets or sets the x coordinate.

The setter delegates to moveByDx


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

Gets or sets the y coordinate.

The setter delegates to moveByDy


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
ReshapeableHandle()Constructor
public function ReshapeableHandle(index:uint, location:IPoint, rect:IRectangle, reshapeable:IReshapeable, minimumSize:ISize, maximumSize:ISize)

Constructor for subclasses that creates a handle for the given position using the location instance as the location for the handle.

The instance modifies the instances using the reshapeable interface and reads the current state using the rect. The handle will automatically trim changes of the rectangle to the specified minimum and maximum size.

Parameters
index:uint — The position index to use for the handle. 0 for north-west up to 8 for south-east.
 
location:IPoint — The location to use for the handle.
 
rect:IRectangle — The rectangle.
 
reshapeable:IReshapeable — The reshapeable to write the changes to.
 
minimumSize:ISize — The minimum size allowed for the rectangle.
 
maximumSize:ISize — The maximum size allowed for the rectangle.
Method Detail
cancelDrag()method
public function cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void

Delegates the original position to setPosition

Parameters

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

create()method 
public static function create(position:uint, location:IPoint, rect:IRectangle, reshapeable:IReshapeable, minimumSize:ISize = null, maximumSize:ISize = null):ReshapeableHandle

Creates a handle for the given position using the location instance as the position for the handle.

Parameters

position:uint — One position of the RectangleHandlePositions to use for the handle.
 
location:IPoint — The location to use for the handle.
 
rect:IRectangle — The rectangle.
 
reshapeable:IReshapeable — The reshapeable to write the changes to.
 
minimumSize:ISize (default = null) — The minimum size allowed for the rectangle. If null, ImmutableSize.EMPTY is used.
 
maximumSize:ISize (default = null) — The maximum size allowed for the rectangle. If null, ImmutableSize.UNBOUND is used.

Returns
ReshapeableHandle — 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):ReshapeableHandle

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

Parameters

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

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

See also

createFromReshapeable()method 
public static function createFromReshapeable(position:uint, rect:IRectangle, reshapeable:IReshapeable):ReshapeableHandle

Creates a handle for the given position that uses and modifies the instances using the reshapeable interface.

The implementation uses the rect instance to determine the position of the handle and writes changes to the geometry of the rectangle to the reshapeable.

Parameters

position:uint — One position of the RectangleHandlePositions to use for the handle.
 
rect:IRectangle — The rectangle
 
reshapeable:IReshapeable — The reshapeable to write changes to.

Returns
ReshapeableHandle — 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 canvas to work on.
 
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 x coordinate before the drag operation started.
 
originalX:Number — The y coordinate before the drag operation started.
 
originalY:Number — The new x coordinate.
 
newX:Number — The new y coordinate.
 
newY:Number

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

This implementation does nothing.

Parameters

context:IInputModeContext — The canvas to work on.

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. Delegates 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. Delegates 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. Delegates to moveBy

Parameters

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