Packagecom.yworks.graph.input
Classpublic class SimpleEdgePositionHandler
InheritanceSimpleEdgePositionHandler Inheritance Object
Implements IPositionHandler

An IPositionHandler implementation for edges which moves the bends on selected edges during move operations.

The position handler can be enabled by adding it to the edge's lookup:

     // graphDecorator is the current (view) graph's GraphDecorator
     graphDecorator.edgeDecorator.positionHandlerDecorator.setFactory(
       function(edge:IEdge):IPositionHandler {
           return new SimpleEdgePositionHandler(edge);
         });
     



Public Properties
 PropertyDefined By
  x : Number
[read-only] Returns the x coordinate of the current position of the element.
SimpleEdgePositionHandler
  y : Number
[read-only] Returns the y coordinate of the current position of the element.
SimpleEdgePositionHandler
Public Methods
 MethodDefined By
  
Creates a new instance for the given edge.
SimpleEdgePositionHandler
  
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Called by clients to indicate that the dragging has been canceled by the user.
SimpleEdgePositionHandler
  
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
Called by clients to indicate that the repositioning has just been finished.
SimpleEdgePositionHandler
  
handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
Called by clients to indicate that the element has been dragged and its position should be updated.
SimpleEdgePositionHandler
  
Called by clients to indicate that the element is going to be dragged.
SimpleEdgePositionHandler
  
setPosition(x:Number, y:Number):void
Called by clients to set the position to the given coordinates.
SimpleEdgePositionHandler
Property Detail
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
SimpleEdgePositionHandler()Constructor
public function SimpleEdgePositionHandler(edge:IEdge)

Creates a new instance for the given edge.

Parameters
edge:IEdge — The edge to create the instance for.
Method Detail
cancelDrag()method
public function cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void

Called by clients to indicate that the dragging has been canceled by the user.

This method may be called after the initial initializeDrag and zero or more invocations of handleMove. Implementations should reset the position of the items they modify to their initial state. Alternatively to this method the dragFinished method might be called.

Parameters

context:IInputModeContext — The context to retrieve information about the drag from.
 
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.

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

Called by clients to indicate that the repositioning has just been finished. This method may be called after the initial initializeDrag and zero or more invocations of handleMove. Alternatively to this method the cancelDrag method might be called.

Parameters

context:IInputModeContext — The context to retrieve information about the drag from.
 
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

Called by clients to indicate that the element has been dragged and its position should be updated.

This method may be called more than once after an initial initializeDrag and will be followed by either dragFinished or cancelDrag.

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

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

Called by clients to indicate that the element is going to be dragged.

This call will be followed by one or more calls to handleMove, and a final dragFinished or cancelDrag.

Parameters

context:IInputModeContext — The context to retrieve information about the drag from.

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

Called by clients to set the position to the given coordinates.

It is up to the implementation to decide how the position of the element in question should be interpreted. This may be the upper left corner of the element, its center or anything else. The implementation may decide to not use the values provided or use different values internally.

Parameters

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