Packagecom.yworks.canvas.input
Classpublic class CompositePositionHandler
InheritanceCompositePositionHandler Inheritance Object
Implements IPositionHandler

A composite implementation of the IPositionHandler interface.

Instances of this class to transparently treat multiple instances of IPositionHandler like a single instance.



Public Properties
 PropertyDefined By
  x : Number
[read-only] Gets the virtual x coordinate of this composite.
CompositePositionHandler
  y : Number
[read-only] Gets the virtual y coordinate of this composite.
CompositePositionHandler
Public Methods
 MethodDefined By
  
Constructs a new compound IPositionHandlerinstance.
CompositePositionHandler
  
addHandle(tag:Object, handle:IHandle):void
Adds an IHandle to this instance using the given tag for later removal.
CompositePositionHandler
  
addLocatedMovable(tag:Object, location:IPoint, handler:IMovable):void
Adds another IPositionHandler instance to this instance using the given tag for later removal.
CompositePositionHandler
  
addMovable(tag:Object, movable:IMovable):void
Adds an IMutablePoint to this instance using the given tag for later removal.
CompositePositionHandler
  
addMutablePoint(tag:Object, point:IMutablePoint):void
Adds an IMutablePoint to this instance using the given tag for later removal.
CompositePositionHandler
  
addPositionHandler(tag:Object, handler:IPositionHandler):void
Adds another IPositionHandler instance to this instance using the given tag for later removal.
CompositePositionHandler
  
addPositionHandlerFromLookup(tag:Object, lookup:ILookup):Boolean
Tries to add a new handler to this composite by inspecting the provided lookup for suitable implementations that can be wrapped by this instance.
CompositePositionHandler
  
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
CompositePositionHandler
  
clear():void
Removes all previously registered handlers.
CompositePositionHandler
  
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
Called by clients to indicate that the repositioning has just been finished.
CompositePositionHandler
  
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.
CompositePositionHandler
  
Called by clients to indicate that the element is going to be dragged.
CompositePositionHandler
  
removePositionHandler(tag:Object):void
Removes an implementation from this composite that has previously been added to this instance using the given tag.
CompositePositionHandler
  
setPosition(x:Number, y:Number):void
Sets the virtual position of this composite.
CompositePositionHandler
Property Detail
xproperty
x:Number  [read-only]

Gets the virtual x coordinate of this composite.


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

Gets the virtual y coordinate of this composite.


Implementation
    public function get y():Number
Constructor Detail
CompositePositionHandler()Constructor
public function CompositePositionHandler()

Constructs a new compound IPositionHandlerinstance.

Use the various add methods to add more instances to this composite.

Method Detail
addHandle()method
public function addHandle(tag:Object, handle:IHandle):void

Adds an IHandle to this instance using the given tag for later removal.

This new position handler is created by delegating the calls to the handle implementation correspondingly.

Parameters

tag:Object — An instance to tag the handler which must be used for removing the instance from this composite later.
 
handle:IHandle — A handle to delegate the repositioning to.

addLocatedMovable()method 
public function addLocatedMovable(tag:Object, location:IPoint, handler:IMovable):void

Adds another IPositionHandler instance to this instance using the given tag for later removal.

This new position handler is created using the location and IMovable implementation provided.

Parameters

tag:Object — An instance to tag the handler which must be used for removing the instance from this composite later.
 
location:IPoint — A live view of the location of the element to reposition.
 
handler:IMovable — The movable implementation that will be used for repositioning the element.

addMovable()method 
public function addMovable(tag:Object, movable:IMovable):void

Adds an IMutablePoint to this instance using the given tag for later removal.

This new position handler is created using the IMovable implementation provided.

Parameters

tag:Object — An instance to tag the handler which must be used for removing the instance from this composite later.
 
movable:IMovable — The movable implementation that will be used for repositioning the element.

addMutablePoint()method 
public function addMutablePoint(tag:Object, point:IMutablePoint):void

Adds an IMutablePoint to this instance using the given tag for later removal.

This new position handler is created by delegating the calls to the point implementation correspondingly.

Parameters

tag:Object — An instance to tag the handler which must be used for removing the instance from this composite later.
 
point:IMutablePoint — A point implementation to delegate the repositioning to.

addPositionHandler()method 
public function addPositionHandler(tag:Object, handler:IPositionHandler):void

Adds another IPositionHandler instance to this instance using the given tag for later removal.

Parameters

tag:Object — An instance to tag the handler which must be used for removing the instance from this composite later.
 
handler:IPositionHandler — The instance to add to this composite.

addPositionHandlerFromLookup()method 
public function addPositionHandlerFromLookup(tag:Object, lookup:ILookup):Boolean

Tries to add a new handler to this composite by inspecting the provided lookup for suitable implementations that can be wrapped by this instance.

This implementation tries to find the following implementations in the lookup:

Parameters

tag:Object — The tag to use.
 
lookup:ILookup — The lookup to query implementations from.

Returns
Boolean — Whether an implementation has been found and a handler has been added to this composite.

See also

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

Parameters

context:IInputModeContext
 
originalX:Number
 
originalY:Number

clear()method 
public function clear():void

Removes all previously registered handlers.

See also

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.

removePositionHandler()method 
public function removePositionHandler(tag:Object):void

Removes an implementation from this composite that has previously been added to this instance using the given tag.

Parameters

tag:Object — The tag to identify the handler to remove from this composite.

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

Sets the virtual position of this composite.

This will reposition all elements included in this composite accordingly.

Parameters

x:Number
 
y:Number