Packagecom.yworks.canvas.input
Classpublic class MoveInputMode
InheritanceMoveInputMode Inheritance StateMachineInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher
Subclasses GraphMoveInputMode, MoveLabelInputMode, ReparentStripeInputMode

Generic IInputMode implementation that can be used to move something in the canvas using the mouse.

This implementation uses the hitTestable to determine where the user can begin dragging the selection. It will then use the movable and/or positionHandler to delegate the actual work of moving the elements to.



Public Properties
 PropertyDefined By
  bridgeUpdateMode : BridgeUpdateMode
Determines how bridges shall be rendered during the move.
MoveInputMode
 InheritedcanceledState : State
[read-only] Returns the canceled state of the state machine.
StateMachineInputMode
  cancelRecognizer : Function
Gets or sets the "cancel" recognizer.
MoveInputMode
 Inheritedcanvas : CanvasComponent
[read-only] The canvas instance this mode is currently installed in or null
AbstractInputMode
 Inheritedcontroller : ConcurrencyController
Gets or injects the ConcurrencyController for this instance.
AbstractConcurrentInputMode
  disableSnappingRecognizer : Function
Gets or sets event recognizer that recognizes when the user temporarily disables snapping.
MoveInputMode
  draggedRecognizer : Function
Gets or sets the "dragged" state recognizer.
MoveInputMode
 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.
MoveInputMode
  hitTestable : IHitTestable
Gets or sets the IHitTestable that will be used by this mode to determine where the user may start dragging.
MoveInputMode
  hoverRecognizer : Function
A function which returns true if the mouse is hovering over a movable item.
MoveInputMode
  initialX : Number
[read-only] Returns the initial x position where the dragging was initiated.
MoveInputMode
  initialY : Number
[read-only] Returns the initial y position where the dragging was initiated.
MoveInputMode
 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
  movable : IMovable
Gets or sets the IMovable that will be used during dragging to perform the actual movement.
MoveInputMode
  moveCursor : Cursor
Gets or sets the cursor to use during the move.
MoveInputMode
  positionHandler : IPositionHandler
Gets or sets the IPositionHandler that will be used to handle that actual movement of the elements during the drag.
MoveInputMode
  preferredCursor : Cursor
[override]
MoveInputMode
  pressedRecognizer : Function
Gets or sets the "pressed" state recognizer.
MoveInputMode
  releasedRecognizer : Function
Gets or sets the "released" recognizer.
MoveInputMode
  snapContext : SnapContext
The SnapContext which manages snapping model items to certain coordinates (e.g.
MoveInputMode
 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 instance.
MoveInputMode
 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
 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
  
Callback used by the state machine to arm this mode.
MoveInputMode
  
Callback used by the state machine to initialize the dragging.
MoveInputMode
  
Called when the users cancels the dragging of the handle.
MoveInputMode
 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
  
Creates an IInputModeContext for use with the IPositionHandler interface for the upcoming move operation.
MoveInputMode
 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
  
Callback used by the state machine to disarm this mode.
MoveInputMode
  
Called by the state machine to end the dragging.
MoveInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
hasMutex():Boolean
Determines whether this instance owns the input mutex.
AbstractConcurrentInputMode
 Inherited
initialize():void
Performs one-time initialization of this instance.
AbstractInputMode
  
initializeStateMachine(machine:StateMachine, startState:State, canceledState:State, stoppedState:State, finishedState:State):void
[override] Called to initialize the state machine.
MoveInputMode
 Inherited
[override] Installs this mode into the given canvas.
StateMachineInputMode
 Inherited
Installs all necessary listeners to trigger the run method.
StateMachineInputMode
 Inherited
invalidate():void
Convenience method for subclass implementations that invalidates the canvasComponent this mode is currently installed in.
AbstractInputMode
 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
Returns true if the mouse is hovering over a movable item.
MoveInputMode
 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 dragging.
MoveInputMode
  
Callback triggered once the drag has been canceled.
MoveInputMode
  
Callback triggered once the drag has been finalized.
MoveInputMode
  
onDragging():void
Callback triggered for each drag.
MoveInputMode
  
Triggers the dragStarted event.
MoveInputMode
  
Triggers the dragStarting event.
MoveInputMode
 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
 Inherited
[override] Uninstalls this mode from the canvas.
StateMachineInputMode
 Inherited
Uninstalls all listeners, this instance has installed on calling intallListeners()
StateMachineInputMode
Events
 Event Summary Defined By
  Dispatched when the drag has been canceled.MoveInputMode
  Dispatched when the drag has been finished.MoveInputMode
  Dispatched for every drag.MoveInputMode
  Dispatched when the drag is initialized and has started.MoveInputMode
  Dispatched when the drag has started.MoveInputMode
 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
bridgeUpdateModeproperty
bridgeUpdateMode:BridgeUpdateMode

Determines how bridges shall be rendered during the move.

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

Gets or sets the "cancel" recognizer.

This recognizer recognizes a cancel action during the move.


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

See also

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
draggedRecognizerproperty 
draggedRecognizer:Function

Gets or sets the "dragged" state recognizer.

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


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

See also

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
hitTestableproperty 
hitTestable:IHitTestable

Gets or sets the IHitTestable that will be used by this mode to determine where the user may start dragging.


Implementation
    public function get hitTestable():IHitTestable
    public function set hitTestable(value:IHitTestable):void
hoverRecognizerproperty 
hoverRecognizer:Function

A function which returns true if the mouse is hovering over a movable item.

The default value is isHovering().


Implementation
    public function get hoverRecognizer():Function
    public function set hoverRecognizer(value:Function):void
initialXproperty 
initialX:Number  [read-only]

Returns the initial x position where the dragging was initiated.


Implementation
    public function get initialX():Number
initialYproperty 
initialY:Number  [read-only]

Returns the initial y position where the dragging was initiated.


Implementation
    public function get initialY():Number
movableproperty 
movable:IMovable

Gets or sets the IMovable that will be used during dragging to perform the actual movement.

For a more fine grained control of how the drag should be performed, use the positionHandler property instead.


Implementation
    public function get movable():IMovable
    public function set movable(value:IMovable):void
moveCursorproperty 
moveCursor:Cursor

Gets or sets the cursor to use during the move.


Implementation
    public function get moveCursor():Cursor
    public function set moveCursor(value:Cursor):void
positionHandlerproperty 
positionHandler:IPositionHandler

Gets or sets the IPositionHandler that will be used to handle that actual movement of the elements during the drag.


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


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

Gets or sets the "pressed" state recognizer.

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


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

See also

releasedRecognizerproperty 
releasedRecognizer:Function

Gets or sets the "released" recognizer.

This instance determines when the user has finished the move.


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

See also

snapContextproperty 
snapContext:SnapContext

The SnapContext which manages snapping model items to certain coordinates (e.g. other items). Setting this property to SnapContext.voidInstance will disable snapping, whereas setting it to null will make the child modes use the context from their IInputModeContexts, if available.

The default value is null.


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

See also

SnapContext.voidInstance
IInputModeContext
onSnapContextChanged
SnapResult
CanvasComponent
Constructor Detail
MoveInputMode()Constructor
public function MoveInputMode()

Creates a new instance.

Method Detail
arm()method
protected function arm(evt:TransitionEvent):void

Callback used by the state machine to arm this mode.

This method will be invoked if the mouse hovers over the selection.

Parameters

evt:TransitionEvent

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

Callback used by the state machine to initialize the dragging.

This method will request the input mutex.

Parameters

evt:TransitionEvent

See also

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

Called when the users cancels the dragging of the handle.

Parameters

evt:TransitionEvent

createPositionHandlerInputModeContext()method 
protected function createPositionHandlerInputModeContext():IInputModeContext

Creates an IInputModeContext for use with the IPositionHandler interface for the upcoming move operation.

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

Callback used by the state machine to disarm this mode.

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

Parameters

evt:TransitionEvent

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

Called by the state machine to end the dragging.

This method will delegate the actual cleanup work to the movable and/or positionHandler.

Parameters

evt:TransitionEvent

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

Called to initialize the state machine.

This implementation does nothing.

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.

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

Returns true if the mouse is hovering over a movable item.

Parameters

evt:Event

Returns
Booleantrue if the mouse is hovering over a movable item.
onDrag()method 
protected function onDrag(evt:TransitionEvent):void

Called by the state machine during the dragging.

This method will delegate the actual dragging work to the movable and/or positionHandler.

Parameters

evt:TransitionEvent

onDragCanceled()method 
protected function onDragCanceled():void

Callback triggered once the drag has been canceled. This method triggers the dragCanceled event.

onDragFinished()method 
protected function onDragFinished():void

Callback triggered once the drag has been finalized.

This method triggers the dragFinished event.

onDragging()method 
protected function onDragging():void

Callback triggered for each drag. This method triggers the dragging event.

onDragStarted()method 
protected function onDragStarted():void

Triggers the dragStarted event.

onDragStarting()method 
protected function onDragStarting():void

Triggers the dragStarting event.

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.

dragging Event  
Event Object Type: com.yworks.canvas.input.DragEvent
DragEvent.type property = com.yworks.canvas.input.DragEvent.DRAGGING

Dispatched for every drag.

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.