public interface IDragHandler
CanvasControl
.
Items can be dragged with the mouse and an instance of this class will modify their position accordingly. A drag will
trigger the invocation of initializeDrag(IInputModeContext)
, zero or more handleMove(IInputModeContext, PointD, PointD)
calls, and will be finalized by either dragFinished(IInputModeContext, PointD, PointD)
or
cancelDrag(IInputModeContext, PointD)
.
IPositionHandler
,
IHandle
,
IInputModeContext
Modifier and Type | Method and Description |
---|---|
void |
cancelDrag(IInputModeContext context,
PointD originalLocation)
Called by clients to indicate that the dragging has been canceled by the user.
|
void |
dragFinished(IInputModeContext context,
PointD originalLocation,
PointD newLocation)
Called by clients to indicate that the repositioning has just been finished.
|
IPoint |
getLocation()
Returns a view of the location of the item.
|
void |
handleMove(IInputModeContext context,
PointD originalLocation,
PointD newLocation)
Called by clients to indicate that the element has been dragged and its position should be updated.
|
void |
initializeDrag(IInputModeContext context)
Called by clients to indicate that the element is going to be dragged.
|
void cancelDrag(IInputModeContext context, PointD originalLocation)
This method may be called after the initial initializeDrag(IInputModeContext)
and zero or more invocations of
handleMove(IInputModeContext, PointD, PointD)
. Implementations should reset the position of the items they
modify to their initial state. Alternatively to this method the dragFinished(IInputModeContext, PointD, PointD)
method might be called.
context
- The context to retrieve information about the drag from.originalLocation
- The value of the coordinate of the Location
property at the time of
initializeDrag(IInputModeContext)
.void dragFinished(IInputModeContext context, PointD originalLocation, PointD newLocation)
This method may be called after the initial initializeDrag(IInputModeContext)
and zero or more invocations of
handleMove(IInputModeContext, PointD, PointD)
. Alternatively to this method the cancelDrag(IInputModeContext, PointD)
method might be called.
context
- The context to retrieve information about the drag from.newLocation
- The coordinates in the world coordinate system that the client wants the handle to be at. Depending on the
implementation the Location
may or may not be modified to reflect the new value. This is the same
value as delivered in the last invocation of handleMove(IInputModeContext, PointD, PointD)
originalLocation
- The value of the Location
property at the time of initializeDrag(IInputModeContext)
.IPoint getLocation()
The point describes the current world coordinate of the element that can be modified by this handler.
void handleMove(IInputModeContext context, PointD originalLocation, PointD newLocation)
This method may be called more than once after an initial initializeDrag(IInputModeContext)
and will the final
call will be followed by either one dragFinished(IInputModeContext, PointD, PointD)
or one cancelDrag(IInputModeContext, PointD)
call.
context
- The context to retrieve information about the drag from.originalLocation
- The value of the Location
property at the time of initializeDrag(IInputModeContext)
.newLocation
- The coordinates in the world coordinate system that the client wants the handle to be at. Depending on the
implementation the Location
may or may not be modified to reflect the new value.void initializeDrag(IInputModeContext context)
This call will be followed by one or more calls to handleMove(IInputModeContext, PointD, PointD)
, and a final dragFinished(IInputModeContext, PointD, PointD)
or cancelDrag(IInputModeContext, PointD)
.
context
- The context to retrieve information about the drag from.