Package | com.yworks.canvas.input |
Class | public class DropInputMode |
Inheritance | DropInputMode AbstractConcurrentInputMode AbstractInputMode flash.events.EventDispatcher |
Subclasses | NodeDropInputMode, StripeDropInputMode |
CanvasComponent
.
An instance of DropInputMode
is initialized for an expected data format in the constructor.
There are four events raised by an instance of this class.
DRAG_ENTER
is raised, if a drag operation enters the CanvasComponent
.DRAG_OVER
is raised, if a drag operation moves over the CanvasComponent
after having
entered it.DRAG_DROP
is raised, if a drag is dropped onto the CanvasComponent
.DRAG_EXIT
is raised, if a drag is operation leaves the CanvasComponent
.
Clients can query the current mousePosition
which is updated while a drag is in progress.
Clients get the data from the drag operation by calling dropData
from an event handler
registered for any of these events.
This input mode supports concurrency. It can be added to a MultiplexingInputMode
using
MultiplexingInputMode.addConcurrent(IConcurrentInputMode,int)
.
The DropInputMode
does not work properly together with the native
drag manager in AIR applications. If problems occur the native drag manager
can be disabled by setting useNativeDragManager
to false
in the WindowedApplication
(since Flex 4).
See also
Property | Defined By | ||
---|---|---|---|
canvas : CanvasComponent [read-only]
The canvas instance this mode is currently installed in or null
| AbstractInputMode | ||
controller : ConcurrencyController
Gets or injects the ConcurrencyController for this instance. | AbstractConcurrentInputMode | ||
dropData : Object [read-only]
Gets the data carried by a drag operation. | DropInputMode | ||
dropLocation : IPoint [read-only]
Gets the mouse position after dropping an item. | DropInputMode | ||
enabled : Boolean
Gets or sets the enabled state of this input mode. | AbstractConcurrentInputMode | ||
inputModeContext : IInputModeContext [read-only]
The context instance this mode is currently installed in or
null if this instance is not installed. | AbstractInputMode | ||
installed : 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 | ||
mousePosition : IPoint [read-only]
Gets the current mouse position during drag operations. | DropInputMode | ||
preferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the CanvasComponent. | AbstractConcurrentInputMode | ||
validDropHitTestable : IHitTestable
Gets or sets the IHitTestable that determines whether the given location is a valid drop location. | DropInputMode |
Property | Defined By | ||
---|---|---|---|
dragSource : DragSource [read-only]
The DragSource object containing the data being dragged. | DropInputMode |
Method | Defined By | ||
---|---|---|---|
DropInputMode(expectedDataFormat:String)
Constructs a new instance of class DropInputMode for the expected data format. | DropInputMode | ||
cancel():void [override]
Cleanly cancels this mode. | DropInputMode | ||
dispose():void
Disposes this input mode. | AbstractInputMode | ||
install(context:IInputModeContext):void
Installs this mode into the canvas of the given context. | AbstractInputMode | ||
stop():Boolean [override]
Returns true if this input mode doesn't own
the mutex. | AbstractConcurrentInputMode | ||
uninstall(context:IInputModeContext):void
Uninstalls this mode from the canvas. | AbstractInputMode |
Method | Defined By | ||
---|---|---|---|
acceptDragEnter(e:DragEvent):Boolean
Callback that returns if the current drag may be accepted. | DropInputMode | ||
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex. | AbstractConcurrentInputMode | ||
canvasControl_ViewPointChanged(evt:CanvasEvent):void
Callback that updates the drag location upon view point changes of the CanvasComponent
into which this input mode is installed. | DropInputMode | ||
cleanupDrag():void
This method is called by cancel and after a onDragDrop to cleanup any internal
state. | DropInputMode | ||
dataForFormat(format:String):Object
Gets the data carried by a drag operation that has been registered with the given format. | DropInputMode | ||
fireInstalled():void | AbstractInputMode | ||
fireInstalling():void | AbstractInputMode | ||
fireUninstalled():void | AbstractInputMode | ||
fireUninstalling():void | AbstractInputMode | ||
hasMutex():Boolean
Determines whether this instance owns the input mutex. | AbstractConcurrentInputMode | ||
initialize():void
Performs one-time initialization of this instance. | AbstractInputMode | ||
installCore(context:IInputModeContext):void [override]
Installs this mode into the given canvas. | DropInputMode | ||
invalidate():void
Convenience method for subclass implementations that invalidates
the canvasComponent this mode is currently installed in. | AbstractInputMode | ||
onDisabled():void [override]
Called when the AbstractConcurrentInputMode.enabled property changes to false. | DropInputMode | ||
onDragDrop(e:DragEvent):void
Called whenever a drag is over the canvas. | DropInputMode | ||
onDragEnter(e:DragEvent):void
Called once a drag has entered the canvas. | DropInputMode | ||
onDragExit(e:DragEvent):void
Called whenever a drag is over the canvas. | DropInputMode | ||
onDragOver(e:DragEvent):void
Called whenever a drag is over the canvas. | DropInputMode | ||
onEnabled():void [override]
Called when the AbstractConcurrentInputMode.enabled property changes to true. | DropInputMode | ||
onMutexObtained():void
Called when this instance obtains the InputMutex. | AbstractConcurrentInputMode | ||
onMutexReleased():void
Called when this instance released the InputMutex. | AbstractConcurrentInputMode | ||
Called when the preferredCursor property changes. | AbstractConcurrentInputMode | ||
releaseMutex():void
Releases the mutex that is currently owned by this instance. | AbstractConcurrentInputMode | ||
requestMutex():void
Requests the InputMutex from the current controller. | AbstractConcurrentInputMode | ||
setAccepting(accept:Boolean):void
Tell the DragManager to accept canvas as drop target or sets the drop target to null. | DropInputMode | ||
setDragLocation(coordinates:IPoint):void
This method updates the mousePosition according to the coordinates passed in. | DropInputMode | ||
uninstallCore(context:IInputModeContext):void [override]
Uninstalls this mode from the canvas. | DropInputMode |
Event | Summary | Defined By | ||
---|---|---|---|---|
This event is raised, if a drag operation is dropped onto the CanvasComponent into which this instance is installed. | DropInputMode | |||
This event is raised, if a drag operation enters the CanvasComponent into which this instance is installed. | DropInputMode | |||
This event is raised, if a drag operation leaves the CanvasComponent into which this instance is installed. | DropInputMode | |||
This event is raised, if a drag operation drags over the CanvasComponent into which this instance is installed. | DropInputMode | |||
Dispatched after the input mode was installed. | AbstractInputMode | |||
Dispatched before the input mode will be installed. | AbstractInputMode | |||
Dispatched when the default cursor changed. | AbstractConcurrentInputMode | |||
Dispatched after the input mode was uninstalled. | AbstractInputMode | |||
Dispatched before the input mode will be uninstalled. | AbstractInputMode |
dragSource | property |
dragSource:DragSource
[read-only]
The DragSource object containing the data being dragged.
This is only valid, if a drag entered the CanvasComponent
first.
protected function get dragSource():DragSource
dropData | property |
dropData:Object
[read-only]
Gets the data carried by a drag operation.
This is only valid, if a drag entered the CanvasComponent
first.
public function get dropData():Object
dropLocation | property |
dropLocation:IPoint
[read-only]
Gets the mouse position after dropping an item.
The position is returned in world coordinates according to the CanvasComponent
into which this
input mode is installed.
public function get dropLocation():IPoint
mousePosition | property |
mousePosition:IPoint
[read-only]
Gets the current mouse position during drag operations.
The position is returned in world coordinates according to the CanvasComponent
into which this
input mode is installed.
public function get mousePosition():IPoint
validDropHitTestable | property |
validDropHitTestable:IHitTestable
Gets or sets the IHitTestable
that determines whether the given location is a valid drop location.
The hit testable yields true
for valid drop locations.
public function get validDropHitTestable():IHitTestable
public function set validDropHitTestable(value:IHitTestable):void
DropInputMode | () | Constructor |
public function DropInputMode(expectedDataFormat:String)
Constructs a new instance of class DropInputMode
for the expected data format.
The input mode fires events (see DragEntered
and DragDropped
) only if a drag
operation carries data conforming to the given format.
expectedDataFormat:String — This is a string which can be given to DragSource.dataForFormat(String) .
|
acceptDragEnter | () | method |
protected function acceptDragEnter(e:DragEvent):Boolean
Callback that returns if the current drag may be accepted.
Parameters
e:DragEvent — The drag event to adjust the effect.
|
Boolean |
cancel | () | method |
override public function cancel():void
Cleanly cancels this mode.
canvasControl_ViewPointChanged | () | method |
protected function canvasControl_ViewPointChanged(evt:CanvasEvent):void
Callback that updates the drag location upon view point changes of the CanvasComponent
into which this input mode is installed.
Parameters
evt:CanvasEvent — The CanvasEvent of type CanvasEvent.VIEW_POINT_CHANGED that triggered
this update.
|
See also
cleanupDrag | () | method |
protected function cleanupDrag():void
This method is called by cancel
and after a onDragDrop
to cleanup any internal
state.
dataForFormat | () | method |
protected function dataForFormat(format:String):Object
Gets the data carried by a drag operation that has been registered with the given format.
This is only valid, if a drag entered the CanvasComponent
first.
Parameters
format:String |
Object |
installCore | () | method |
override protected function installCore(context:IInputModeContext):void
Installs this mode into the given canvas. Clients should not call this method as this is handled by the framework.
Parameters
context:IInputModeContext — The context to install this mode into.
|
onDisabled | () | method |
override protected function onDisabled():void
Called when the AbstractConcurrentInputMode.enabled
property changes to false
.
This implementation removes the drag and drop listeners from the canvas.
onDragDrop | () | method |
protected function onDragDrop(e:DragEvent):void
Called whenever a drag is over the canvas.
Parameters
e:DragEvent — The drag event with type DragEvent.DRAG_DROP .
|
onDragEnter | () | method |
protected function onDragEnter(e:DragEvent):void
Called once a drag has entered the canvas.
Parameters
e:DragEvent — The drag event with type DragEvent.DRAG_ENTER .
|
onDragExit | () | method |
protected function onDragExit(e:DragEvent):void
Called whenever a drag is over the canvas.
Parameters
e:DragEvent — The drag event with type DragEvent.DRAG_EXIT .
|
onDragOver | () | method |
protected function onDragOver(e:DragEvent):void
Called whenever a drag is over the canvas.
Parameters
e:DragEvent — The drag event with type DragEvent.DRAG_OVER .
|
onEnabled | () | method |
override protected function onEnabled():void
Called when the AbstractConcurrentInputMode.enabled
property changes to true
.
This implementation registers the drag and drop listeners on the canvas.
setAccepting | () | method |
protected function setAccepting(accept:Boolean):void
Tell the DragManager to accept canvas
as drop target or sets the drop target to null.
Parameters
accept:Boolean — If true and canvas wasn't the drop target,
DragManager.acceptDragDrop(canvas) is called.
If false and canvas was the drop target, DragManager.acceptDragDrop(null)
is called.
|
See also
setDragLocation | () | method |
protected function setDragLocation(coordinates:IPoint):void
This method updates the mousePosition
according to the coordinates passed in.
It is called prior to the onDragEnter
, onDragOver
and onDragDrop
methods.
Parameters
coordinates:IPoint — The current location of the mouse in world coordinates.
|
uninstallCore | () | method |
override protected function uninstallCore(context:IInputModeContext):void
Uninstalls this mode from the canvas. Clients should not call this method as this is handled by the framework.
Parameters
context:IInputModeContext — The context.
|
dragDrop | Event |
mx.events.DragEvent
mx.events.DragEvent.DRAG_DROP
This event is raised, if a drag operation is dropped onto the CanvasComponent
into which this
instance is installed.
No event is raised
enabled
,See also
dragEnter | Event |
mx.events.DragEvent
mx.events.DragEvent.DRAG_ENTER
This event is raised, if a drag operation enters the CanvasComponent
into which this instance
is installed.
No event is raised
enabled
,See also
dragExit | Event |
mx.events.DragEvent
mx.events.DragEvent.DRAG_EXIT
This event is raised, if a drag operation leaves the CanvasComponent
into which this instance
is installed.
No event is raised
enabled
,See also
dragOver | Event |
mx.events.DragEvent
mx.events.DragEvent.DRAG_OVER
This event is raised, if a drag operation drags over the CanvasComponent
into which this instance
is installed.
No event is raised
enabled
,See also