Packagecom.yworks.canvas.input
Classpublic class HandleInputMode
InheritanceHandleInputMode Inheritance StateMachineInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher

An IInputMode implementation that can handle a collection of IHandles.

This mode will render a visual representation of IHandles in the CanvasComponent and deal with mouse gestures that drag the visual representations accordingly.



Public Properties
 PropertyDefined By
  active : Boolean
Whether this mode is active.
HandleInputMode
  bridgeUpdateMode : BridgeUpdateMode
Determines whether rendering bridges shall be disabled during the drag.
HandleInputMode
 InheritedcanceledState : State
[read-only] Returns the canceled state of the state machine.
StateMachineInputMode
  cancelRecognizer : Function
The "cancel" state recognizer.
HandleInputMode
 Inheritedcanvas : CanvasComponent
[read-only] The canvas instance this mode is currently installed in or null
AbstractInputMode
  canvasGroupProvider : ICanvasGroupProvider
Gets or sets the canvas object group provider this mode should render the visual representations of the handles in.
HandleInputMode
 Inheritedcontroller : ConcurrencyController
Gets or injects the ConcurrencyController for this instance.
AbstractConcurrentInputMode
  currentHandle : IHandle
[read-only] Gets the handle that is currently being moved or null otherwise.
HandleInputMode
  disableSnappingRecognizer : Function
Gets or sets event recognizer that recognizes when the user temporarily disables snapping.
HandleInputMode
  displayObjectCreator : IDisplayObjectCreator
The IDisplayObjectCreator implementation that creates the visual representations of the handles.
HandleInputMode
  draggedRecognizer : Function
The "dragged" state recognizer.
HandleInputMode
 Inheritedenabled : Boolean
Gets or sets the enabled state of this input mode.
AbstractConcurrentInputMode
  enableSnappingRecognizer : Function
Gets or sets event recognizer that recognizes when the user reenables temporarily disabled snapping.
HandleInputMode
  handles : ICollectionModel
Gets or sets the collection of IHandles this mode manages.
HandleInputMode
 InheritedinputModeContext : IInputModeContext
[read-only] The context instance this mode is currently installed in or null if this instance is not installed.
AbstractInputMode
 Inheritedinstalled : Boolean
[read-only] Whether this mode is currently installed, i.e if a call to the canvas property will yield a non-null result.
AbstractInputMode
 InheritedlastMouseEvent : CanvasMouseEvent
[read-only] Returns the last mouse event.
StateMachineInputMode
  preferredCursor : Cursor
[override]
HandleInputMode
  pressedRecognizer : Function
The "pressed" state recognizer.
HandleInputMode
  releasedRecognizer : Function
The "released" state recognizer.
HandleInputMode
  snapContext : SnapContext
The SnapContext which manages snapping model items to certain coordinates (e.g.
HandleInputMode
 InheritedstartState : State
[read-only] Returns the start state of the state machine.
StateMachineInputMode
 InheritedstateMachine : StateMachine
[read-only] Gets the state machine.
StateMachineInputMode
 InheritedstoppedState : State
[read-only] Returns the stopped state of the state machine.
StateMachineInputMode
Protected Properties
 PropertyDefined By
 Inherited_lastEvent : Event
The last Event that has been delivered to this instance.
StateMachineInputMode
 Inherited_lastMouseEvent : CanvasMouseEvent
The last MouseEvent that has been delivered to this instance.
StateMachineInputMode
 InheritedstopEventRecognizer : Function
[read-only] An event recognizer for the state machine that is triggered if this mode has been stoppped.
StateMachineInputMode
Public Methods
 MethodDefined By
  
Creates a new mode with no handles initially.
HandleInputMode
  
addHandle(handle:IHandle):void
Adds a handle to the collection of handles managed by this instance.
HandleInputMode
  
addPointHandle(p:IMutablePoint, cursor:Cursor = null, handleType:uint):IHandle
Factory method that creates and adds a handle to this mode by wrapping a given MutablePoint instance.
HandleInputMode
  
beginDragging(handle:IHandle):void
Method that can be used to initialize the dragging of a given handle by hand.
HandleInputMode
 Inherited
cancel():void
[override] Runs the machine using the cancel and reset events, releases the input mutex and returns.
StateMachineInputMode
 Inherited
dispose():void
Disposes this input mode.
AbstractInputMode
 Inherited
Installs this mode into the canvas of the given context.
AbstractInputMode
  
removeHandle(handle:IHandle):void
Removes a handle from the collection of handles managed by this instance.
HandleInputMode
 Inherited
Runs the machine using a special reset event.
StateMachineInputMode
 Inherited
run(evt:Event):void
Tries to run the virtual machine using the pair of source and event argument to determine which transition to take.
StateMachineInputMode
 Inherited
stop():Boolean
[override] Runs the machine using a special stop event.
StateMachineInputMode
 Inherited
Uninstalls this mode from the canvas.
AbstractInputMode
Protected Methods
 MethodDefined By
  
Transition callback that is invoked when the mouse gets "armed".
HandleInputMode
  
Called by the state machine if a beginning drag gesture has been recognized.
HandleInputMode
  
Called when the user cancels the dragging of the handle.
HandleInputMode
 Inherited
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex.
AbstractConcurrentInputMode
 Inherited
Factory method that creates a canceled State for the given machine.
StateMachineInputMode
  
Factory method that creates the IDisplayObjectCreator implementation that creates the handle visualizations.
HandleInputMode
  
Creates an IInputModeContext for use with the IHandle interface for the upcoming drag operation.
HandleInputMode
 Inherited
Factory method that creates a start State for the given machine.
StateMachineInputMode
 Inherited
Factory method that creates the state machine.
StateMachineInputMode
 Inherited
Factory method that creates a stopped State for the given machine.
StateMachineInputMode
  
Transition callback that is invoked when the mouse gets "disarmed".
HandleInputMode
  
Called by the state machine once that drag has been finalized.
HandleInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
  
getClosestHitHandle(x:Number, y:Number):IHandle
Finds the closest hit handle for the given world coordinate pair.
HandleInputMode
  
handleDistance(handle:IHandle, x:Number, y:Number):Number
Gets the distance from the mouse to the given handle.
HandleInputMode
 Inherited
hasMutex():Boolean
Determines whether this instance owns the input mutex.
AbstractConcurrentInputMode
  
initialize():void
[override] Overridden to create the IDisplayObjectCreator that renders the handles.
HandleInputMode
  
initializeStateMachine(machine:StateMachine, startState:State, canceledState:State, stoppedState:State, finishedState:State):void
[override] Initializes the state machine this input mode uses internally to manage its state.
HandleInputMode
  
[override] Installs the IDisplayObjectCreator into the canvas at the group provided by canvasGroupProvider.
HandleInputMode
 Inherited
Installs all necessary listeners to trigger the run method.
StateMachineInputMode
  
invalidate():void
[override] Convenience method for subclass implementations that invalidates the canvasComponent this mode is currently installed in.
HandleInputMode
 Inherited
isCancelEvent(evt:Event):Boolean
Method that identifies an event as a cancel event.
StateMachineInputMode
 Inherited
isDisabledEvent(evt:Event):Boolean
Method that identifies an event as a disabled event.
StateMachineInputMode
 Inherited
isEnabledEvent(evt:Event):Boolean
Method that identifies an event as an enabled event.
StateMachineInputMode
  
isHovering(evt:Event):Boolean
Event recognizer callback used to determine whether the mouse is currently hovering over a handle.
HandleInputMode
 Inherited
isMutexAquiredEvent(evt:Event):Boolean
Method that identifies an event as a mutexAquired event.
StateMachineInputMode
 Inherited
isMutexLostEvent(evt:Event):Boolean
Method that identifies an event as a mutexLost event.
StateMachineInputMode
 Inherited
isStopEvent(evt:Event):Boolean
Method that identifies an event as a stop event.
StateMachineInputMode
 Inherited
Called when the cancel state has been entered.
StateMachineInputMode
 Inherited
onDisable():void
Runs the state machine using a disable event.
StateMachineInputMode
 Inherited
onDisabled():void
Called when the enabled property changes to false.
AbstractConcurrentInputMode
  
Called by the state machine during the drag.
HandleInputMode
  
Callback triggered when the drag has been canceled.
HandleInputMode
  
Callback triggered once the drag has been finalized.
HandleInputMode
  
Callback triggered when the drag is initialized and has started.
HandleInputMode
  
Callback triggered when the user starts dragging.
HandleInputMode
 Inherited
onEnable():void
Runs the state machine using a enable event.
StateMachineInputMode
 Inherited
onEnabled():void
Called when the enabled property changes to true.
AbstractConcurrentInputMode
 Inherited
StateMachineInputMode
 Inherited
[override] Runs the state machine using a mutex obtained event.
StateMachineInputMode
 Inherited
[override] Runs the state machine using a mutex lost event.
StateMachineInputMode
 Inherited
onPreferredCursorChanged(oldValue:Cursor, newValue:Cursor):void
Called when the preferredCursor property changes.
AbstractConcurrentInputMode
 Inherited
onRun(evt:Event):void
Callback method that will be called after the state machine has been run using the arguments provided.
StateMachineInputMode
 Inherited
Called when the cancel state has been entered.
StateMachineInputMode
 Inherited
Releases the mutex that is currently owned by this instance.
AbstractConcurrentInputMode
 Inherited
Requests the InputMutex from the current controller.
AbstractConcurrentInputMode
 Inherited
StateMachineInputMode
 Inherited
setPreferredCursorTransition(cursorClass:Class):Function
Factory method that can be used to obtain an listener implementation that sets the given preferredCursor.
StateMachineInputMode
 Inherited
Factory method that can be used to obtain a listener implementation that resets the preferredCursor.
StateMachineInputMode
  
[override] Removes the IDisplayObjectCreator from the canvas.
HandleInputMode
 Inherited
Uninstalls all listeners, this instance has installed on calling intallListeners()
StateMachineInputMode
Events
 Event Summary Defined By
  Dispatched when the drag has been canceled.HandleInputMode
  Dispatched when the drag has been finished.HandleInputMode
  Dispatched when the drag is initialized and has started.HandleInputMode
  Dispatched when the drag has started.HandleInputMode
 InheritedDispatched after the input mode was installed.AbstractInputMode
 InheritedDispatched before the input mode will be installed.AbstractInputMode
 InheritedDispatched when the default cursor changed.AbstractConcurrentInputMode
 InheritedDispatched after the input mode was uninstalled.AbstractInputMode
 InheritedDispatched before the input mode will be uninstalled.AbstractInputMode
Public Constants
 ConstantDefined By
 InheritedINSTALLED : String = installed
[static]
AbstractInputMode
 InheritedINSTALLING : String = installing
[static]
AbstractInputMode
 InheritedPREFERRED_CURSOR_CHANGED : String = preferredCursorChanged
[static]
AbstractConcurrentInputMode
 InheritedUNINSTALLED : String = uninstalled
[static]
AbstractInputMode
 InheritedUNINSTALLING : String = uninstalling
[static]
AbstractInputMode
Property Detail
activeproperty
active:Boolean

Whether this mode is active.

If false, no handles will be drawn.


Implementation
    public function get active():Boolean
    public function set active(value:Boolean):void
bridgeUpdateModeproperty 
bridgeUpdateMode:BridgeUpdateMode

Determines whether rendering bridges shall be disabled during the drag.

If no BridgeManager is set as CanvasComponent.bridgeManager this setting has no effect.

One of the constants defined in class BridgeUpdateMode:

Note that bridge rendering may dramatically reduce the performance for larger graphs during a move gesture which is why it is disabled per default.

The default value is BridgeUpdateMode.ON_END.


Implementation
    public function get bridgeUpdateMode():BridgeUpdateMode
    public function set bridgeUpdateMode(value:BridgeUpdateMode):void

See also

BridgeManager
CanvasComponent.bridgeManager
BridgeUpdateMode
cancelRecognizerproperty 
cancelRecognizer:Function

The "cancel" state recognizer.

This recognizer recognizer the cancel during the move.


Implementation
    public function get cancelRecognizer():Function
    public function set cancelRecognizer(value:Function):void
canvasGroupProviderproperty 
canvasGroupProvider:ICanvasGroupProvider

Gets or sets the canvas object group provider this mode should render the visual representations of the handles in.


Implementation
    public function get canvasGroupProvider():ICanvasGroupProvider
    public function set canvasGroupProvider(value:ICanvasGroupProvider):void
currentHandleproperty 
currentHandle:IHandle  [read-only]

Gets the handle that is currently being moved or null otherwise.


Implementation
    public function get currentHandle():IHandle
disableSnappingRecognizerproperty 
disableSnappingRecognizer:Function

Gets or sets event recognizer that recognizes when the user temporarily disables snapping.

The default value is EventRecognizers#CTRL_PRESSED.


Implementation
    public function get disableSnappingRecognizer():Function
    public function set disableSnappingRecognizer(value:Function):void
displayObjectCreatorproperty 
displayObjectCreator:IDisplayObjectCreator

The IDisplayObjectCreator implementation that creates the visual representations of the handles.


Implementation
    public function get displayObjectCreator():IDisplayObjectCreator
    public function set displayObjectCreator(value:IDisplayObjectCreator):void
draggedRecognizerproperty 
draggedRecognizer:Function

The "dragged" state recognizer.

This recognizer instance will be used to determine when the user is moving a handle.


Implementation
    public function get draggedRecognizer():Function
    public function set draggedRecognizer(value:Function):void
enableSnappingRecognizerproperty 
enableSnappingRecognizer:Function

Gets or sets event recognizer that recognizes when the user reenables temporarily disabled snapping.

The default value is EventRecognizers#CTRL_RELEASED.


Implementation
    public function get enableSnappingRecognizer():Function
    public function set enableSnappingRecognizer(value:Function):void
handlesproperty 
handles:ICollectionModel

Gets or sets the collection of IHandles this mode manages.


Implementation
    public function get handles():ICollectionModel
    public function set handles(value:ICollectionModel):void
preferredCursorproperty 
preferredCursor:Cursor[override]


Implementation
    public function get preferredCursor():Cursor
    public function set preferredCursor(value:Cursor):void
pressedRecognizerproperty 
pressedRecognizer:Function

The "pressed" state recognizer.

This recognizer instance will be used to determine when the user begins to move a handle.


Implementation
    public function get pressedRecognizer():Function
    public function set pressedRecognizer(value:Function):void
releasedRecognizerproperty 
releasedRecognizer:Function

The "released" state recognizer.

This function determines when the user has finished moving the handle.


Implementation
    public function get releasedRecognizer():Function
    public function set releasedRecognizer(value:Function):void
snapContextproperty 
snapContext:SnapContext

The SnapContext which manages snapping model items to certain coordinates (e.g. other items). If set to null this input mode tries to obtain the SnapContext from the IInputModeContext. To explicitly disable snapping, a VoidSnapContext has to be set to this instance.

The default value is null.


Implementation
    public function get snapContext():SnapContext
    public function set snapContext(value:SnapContext):void

See also

SnapContext
IInputModeContext
SnapContext.voidInstance
Constructor Detail
HandleInputMode()Constructor
public function HandleInputMode()

Creates a new mode with no handles initially.

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

Adds a handle to the collection of handles managed by this instance.

Parameters

handle:IHandle — The handle to add.

addPointHandle()method 
public function addPointHandle(p:IMutablePoint, cursor:Cursor = null, handleType:uint):IHandle

Factory method that creates and adds a handle to this mode by wrapping a given MutablePoint instance.

Parameters

p:IMutablePoint — The point to use as a handle.
 
cursor:Cursor (default = null) — The cursor to use.
 
handleType:uint (default = NaN) — the type of the handle to create.

Returns
IHandle — The added handle.
arm()method 
protected function arm(evt:StateChangeEvent):void

Transition callback that is invoked when the mouse gets "armed".

This method will be invoked if the mouse hovers over a handle.

Parameters

evt:StateChangeEvent

beginDrag()method 
protected function beginDrag(t:TransitionEvent):void

Called by the state machine if a beginning drag gesture has been recognized.

Parameters

t:TransitionEvent

beginDragging()method 
public function beginDragging(handle:IHandle):void

Method that can be used to initialize the dragging of a given handle by hand.

This will simulate the user having initialized a drag of the given handle.

Parameters

handle:IHandle — The handle to be dragged.

cancelDrag()method 
protected function cancelDrag(evt:TransitionEvent):void

Called when the user cancels the dragging of the handle.

Parameters

evt:TransitionEvent

createDisplayObjectCreator()method 
protected function createDisplayObjectCreator():IDisplayObjectCreator

Factory method that creates the IDisplayObjectCreator implementation that creates the handle visualizations.

Returns
IDisplayObjectCreator — A default implementation.
createHandleInputModeContext()method 
protected function createHandleInputModeContext():IInputModeContext

Creates an IInputModeContext for use with the IHandle interface for the upcoming drag operation.

Returns
IInputModeContext
disarm()method 
protected function disarm(evt:StateChangeEvent):void

Transition callback that is invoked when the mouse gets "disarmed".

This method will be invoked if the mouse stops hovering over a handle.

Parameters

evt:StateChangeEvent

endDrag()method 
protected function endDrag(t:TransitionEvent):void

Called by the state machine once that drag has been finalized.

Parameters

t:TransitionEvent

getClosestHitHandle()method 
protected function getClosestHitHandle(x:Number, y:Number):IHandle

Finds the closest hit handle for the given world coordinate pair.

Parameters

x:Number — The x coordinate in the world coordinate system.
 
y:Number — The y coordinate in the world coordinate system.

Returns
IHandle — The closest handle that has been hit or null
handleDistance()method 
protected function handleDistance(handle:IHandle, x:Number, y:Number):Number

Gets the distance from the mouse to the given handle.

Parameters

handle:IHandle — The handle to check
 
x:Number — The x world coordinate.
 
y:Number — The y world coordinate.

Returns
Number — A distance metric that returns the distance from the mouse to the handle.

If no handle has been hit, the distance is set to Number.MAX_VALUE.

initialize()method 
override protected function initialize():void

Overridden to create the IDisplayObjectCreator that renders the handles.

initializeStateMachine()method 
override protected function initializeStateMachine(machine:StateMachine, startState:State, canceledState:State, stoppedState:State, finishedState:State):void

Initializes the state machine this input mode uses internally to manage its state.

Parameters

machine:StateMachine — The machine to initialize and configure
 
startState:State — The start state to use.
 
canceledState:State — The canceled state to use.
 
stoppedState:State — The stopped state to use.
 
finishedState:State — The finished state to use.

installCore()method 
override protected function installCore(context:IInputModeContext):void

Installs the IDisplayObjectCreator into the canvas at the group provided by canvasGroupProvider.

Parameters

context:IInputModeContext

invalidate()method 
override protected function invalidate():void

Convenience method for subclass implementations that invalidates the canvasComponent this mode is currently installed in.

isHovering()method 
protected function isHovering(evt:Event):Boolean

Event recognizer callback used to determine whether the mouse is currently hovering over a handle.

Parameters

evt:Event

Returns
Boolean
onDrag()method 
protected function onDrag(t:TransitionEvent):void

Called by the state machine during the drag.

Parameters

t:TransitionEvent

onDragCanceled()method 
protected function onDragCanceled():void

Callback triggered when the drag has been canceled.

This method dispatches the dragCanceled event.

onDragFinished()method 
protected function onDragFinished():void

Callback triggered once the drag has been finalized.

This method dispatches the dragFinished event.

onDragStarted()method 
protected function onDragStarted():void

Callback triggered when the drag is initialized and has started.

This method dispatches the dragStarted event.

onDragStarting()method 
protected function onDragStarting():void

Callback triggered when the user starts dragging.

This method dispatches the dragStarting event.

removeHandle()method 
public function removeHandle(handle:IHandle):void

Removes a handle from the collection of handles managed by this instance.

Parameters

handle:IHandle — The handle to remove.

uninstallCore()method 
override protected function uninstallCore(context:IInputModeContext):void

Removes the IDisplayObjectCreator from the canvas.

Parameters

context:IInputModeContext — The CanvasComponent this input mode is installed on.

Event Detail
dragCanceled Event
Event Object Type: com.yworks.canvas.input.DragEvent
DragEvent.type property = com.yworks.canvas.input.DragEvent.DRAG_CANCELED

Dispatched when the drag has been canceled.

dragFinished Event  
Event Object Type: com.yworks.canvas.input.DragEvent
DragEvent.type property = com.yworks.canvas.input.DragEvent.DRAG_FINISHED

Dispatched when the drag has been finished.

dragStarted Event  
Event Object Type: com.yworks.canvas.input.DragEvent
DragEvent.type property = com.yworks.canvas.input.DragEvent.DRAG_STARTED

Dispatched when the drag is initialized and has started.

dragStarting Event  
Event Object Type: com.yworks.canvas.input.DragEvent
DragEvent.type property = com.yworks.canvas.input.DragEvent.DRAG_STARTING

Dispatched when the drag has started.