Packagecom.yworks.canvas.input
Classpublic class PointHandle
InheritancePointHandle Inheritance Object
Implements IHandle

Convenience implementation of the IHandle interface that delegates most of the work to instances of IPoint and IPointSetter.

This implementation will not do anything special in the initializeDrag, dragFinished, and cancelDrag methods.



Public Properties
 PropertyDefined By
  cursor : Cursor
[read-only] Provides the cursor to display when the mouse hovers over or drags this handle.
PointHandle
  point : IMutablePoint
[read-only] Gets a point implementation that is based on the getter and setter.
PointHandle
  type : uint
[read-only] Returns the type of the handle that can be used by the rendering engine to render types differently.
PointHandle
  x : Number
[read-only] Returns the x coordinate of the current position of the element.
PointHandle
  y : Number
[read-only] Returns the y coordinate of the current position of the element.
PointHandle
Public Methods
 MethodDefined By
  
PointHandle(cursor:Cursor, getter:IPoint, setter:IPointSetter, type:uint)
Constructor for subclass implementations.
PointHandle
  
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
This implementation uses the IPointSetter to set the original values.
PointHandle
  
create(point:IPoint, pointSetter:IPointSetter = null, cursor:Cursor = null, handleType:uint):PointHandle
[static] Factory method that creates a PointHandle using the given IPoint for the location and IPointSetter for modifying it.
PointHandle
  
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
This implementation does nothing.
PointHandle
  
handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
This implementation uses the IPointSetter to set the new values.
PointHandle
  
This implementation does nothing.
PointHandle
  
setPosition(x:Number, y:Number):void
This implementation uses the IPointSetter to set the new values.
PointHandle
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
pointproperty 
point:IMutablePoint  [read-only]

Gets a point implementation that is based on the getter and setter.


Implementation
    public function get point():IMutablePoint
typeproperty 
type:uint  [read-only]

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


Implementation
    public function get type():uint
xproperty 
x:Number  [read-only]

Returns the x coordinate of the current position of the element.

The point describes the current world coordinate position of the element. It is up to the implementation how this position is interpreted. The values returned by this method will be used for the "originalX" parameter in the handleMove, cancelDrag and dragFinished methods.


Implementation
    public function get x():Number
yproperty 
y:Number  [read-only]

Returns the y coordinate of the current position of the element.

The point describes the current world coordinate position of the element. It is up to the implementation how this position is interpreted. The values returned by this method will be used for the "originalY" parameter in the handleMove, cancelDrag and dragFinished methods.


Implementation
    public function get y():Number
Constructor Detail
PointHandle()Constructor
public function PointHandle(cursor:Cursor, getter:IPoint, setter:IPointSetter, type:uint)

Constructor for subclass implementations.

Parameters
cursor:Cursor — The cursor to use.
 
getter:IPoint — The location of the handle.
 
setter:IPointSetter — The location modifier of the handle.
 
type:uint — The type of the cursor to create.

See also

Method Detail
cancelDrag()method
public function cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void

This implementation uses the IPointSetter to set the original values.

Parameters

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

create()method 
public static function create(point:IPoint, pointSetter:IPointSetter = null, cursor:Cursor = null, handleType:uint):PointHandle

Factory method that creates a PointHandle using the given IPoint for the location and IPointSetter for modifying it.

The point and pointSetter are live instances of the handle.

Parameters

point:IPoint — he point to use for the location
 
pointSetter:IPointSetter (default = null) — The point setter to use for moving the handle. If this argument is null, the first argument needs to be an IMutablePoint.
 
cursor:Cursor (default = null) — The cursor to use for the handle
 
handleType:uint (default = NaN) — The type of the handle to create.

Returns
PointHandle — A PointHandle that uses the given point instances to delegate its work to.

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 in which the element is being repositioned.
 
originalX:Number — The value of the x property at the time of initializeDrag.
 
originalY:Number — The value of the y property at the time of initializeDrag.
 
newX:Number — The value of the x coordinate in the world coordinate system that the client wants the handle to be at. Depending on the implementation the x and y properties or may not be modified to reflect the new value. This is the same value as delivered in the last invocation of handleMove.
 
newY:Number — The value of the y coordinate in the world coordinate system that the client wants the handle to be at. Depending on the implementation the x and y properties or may not be modified to reflect the new value. This is the same value as delivered in the last invocation of handleMove.

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

This implementation uses the IPointSetter to set the new values.

Parameters

context:IInputModeContext — The value of the x property at the time of initializeDrag.
 
originalX:Number — The value of the y property at the time of initializeDrag.
 
originalY:Number — The value of the x coordinate in the world coordinate system that the client wants the handle to be at. Depending on the implementation the x property may or may not be modified to reflect the new value.
 
newX:Number — The value of the y coordinate in the world coordinate system that the client wants the handle to be at. Depending on the implementation the y property may or may not be modified to reflect the new value.
 
newY:Number — The delta of the x coordinates since the last call to this method.

Returns
Boolean — Whether the move had any visual effect. This is a hint to the engine to optimize invalidation.
initializeDrag()method 
public function initializeDrag(context:IInputModeContext):void

This implementation does nothing.

Parameters

context:IInputModeContext

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

This implementation uses the IPointSetter to set the new values.

Parameters

x:Number — new x coordinate.
 
y:Number — new y coordinate.