public class HandleInputMode extends Object implements IInputMode
IInputMode
implementation that can handle a collection of IHandle
s.
This mode will render a visual representation of IHandle
s in the CanvasControl
and deal with mouse
gestures that drag the visual representations accordingly.
This mode is Exclusive
by default.
IHandle
Constructor and Description |
---|
HandleInputMode()
Creates a new mode with no handles initially.
|
Modifier and Type | Method and Description |
---|---|
void |
addDragCanceledListener(IEventHandler<InputModeEventArgs> dragCanceledEvent)
Adds the given listener for the
DragCanceled event that occurs when the drag has been canceled. |
void |
addDragCancelingListener(IEventHandler<InputModeEventArgs> dragCancelingEvent)
Adds the given listener for the
DragCanceling event that occurs before the drag will be canceled. |
void |
addDragFinishedListener(IEventHandler<InputModeEventArgs> dragFinishedEvent)
Adds the given listener for the
DragFinished event that occurs once the drag has been finished. |
void |
addDragFinishingListener(IEventHandler<InputModeEventArgs> dragFinishingEvent)
Adds the given listener for the
DragFinishing event that occurs before the drag will be finished. |
void |
addDraggedListener(IEventHandler<InputModeEventArgs> draggedEvent)
Adds the given listener for the
Dragged event that occurs at the end of every drag. |
void |
addDraggingListener(IEventHandler<InputModeEventArgs> draggingEvent)
Adds the given listener for the
Dragging event that occurs at the start of every drag. |
void |
addDragStartedListener(IEventHandler<InputModeEventArgs> dragStartedEvent)
Adds the given listener for the
DragStarted event that occurs once the drag is initialized and has started. |
void |
addDragStartingListener(IEventHandler<InputModeEventArgs> dragStartingEvent)
Adds the given listener for the
DragStarting event that occurs once the drag is starting. |
void |
addHandle(IHandle handle)
Adds a handle to the collection of handles managed by this instance.
|
IHandle |
addHandle(IMutablePoint location)
Factory method that creates and
adds a handle to this mode by wrapping a given IMutablePoint
instance. |
IHandle |
addHandle(IMutablePoint location,
Cursor cursor)
Factory method that creates and
adds a handle to this mode by wrapping a given IMutablePoint
instance. |
IHandle |
addHandle(IMutablePoint location,
Cursor cursor,
HandleTypes type)
Factory method that creates and
adds a handle to this mode by wrapping a given IMutablePoint
instance. |
protected void |
arm(IHandle handle)
Callback method that is invoked when this mode gets "armed".
|
void |
beginDragging(IHandle handle)
Method that can be used to initialize the dragging of a given handle by hand.
|
void |
cancel()
Called by the client to unconditionally cancel all editing.
|
protected IInputModeContext |
createHandleInputModeContext()
Creates an
IInputModeContext for use with the IHandle interface for the upcoming drag operation. |
protected InputModeEventArgs |
createInputModeEventArgs()
Helper method that yields a suitably configured
InputModeEventArgs for this input mode. |
protected Node |
createVisual(IRenderContext context,
IHandle handle)
Callback that creates the
Node for the given handle. |
protected void |
disarm()
Callback method that is invoked when this mode gets "disarmed".
|
IEnumerable<IModelItem> |
getAffectedItems()
Gets an immutable snapshot of the
IModelItem s affected by the currently modified handle
gesture. |
IEventRecognizer |
getCancelRecognizer()
Gets the "cancel" recognizer.
|
protected IHandle |
getClosestHitHandle(PointD location)
Finds the closest hit handle for the given world coordinate pair.
|
protected IHandle |
getClosestHitHandleTouch(PointD location)
Finds the closest hit handle for the given world coordinate pair.
|
protected ConcurrencyController |
getController()
Returns the installed
Controller . |
IHandle |
getCurrentHandle()
Gets the handle that is currently being moved or
null otherwise. |
IEventRecognizer |
getDisableSnappingRecognizer()
Gets event recognizer that recognizes when the user temporarily disables snapping.
|
IEventRecognizer |
getDraggedRecognizer()
Gets the "dragged" recognizer.
|
IEventRecognizer |
getDraggedRecognizerTouch()
Gets the "dragged" recognizer for touch input.
|
IEventRecognizer |
getEnableSnappingRecognizer()
Gets event recognizer that recognizes when the user reenables temporarily disabled snapping.
|
IObservableCollection<IHandle> |
getHandles()
Gets the collection of
IHandle s this mode manages. |
IInputModeContext |
getInputModeContext()
Returns the context instance this mode is currently installed in or
null if this instance is not installed. |
IEventRecognizer |
getPressedRecognizer()
Gets the "pressed" state recognizer.
|
IEventRecognizer |
getPressedRecognizerTouch()
Gets the "pressed" state recognizer for touch input.
|
int |
getPriority()
The priority of this input mode.
|
IEventRecognizer |
getReleasedRecognizer()
Gets the "released" recognizer.
|
IEventRecognizer |
getReleasedRecognizerTouch()
Gets the "released" recognizer for touch input.
|
SnapContext |
getSnapContext()
The
SnapContext which manages snapping model items to certain coordinates (for instance, other
items). |
protected boolean |
handleIsHit(IHandle handle,
PointD location,
PointD distance)
Determines whether a given handle has been visually hit by the mouse at the given world coordinates.
|
protected boolean |
handleIsHitTouch(IHandle handle,
PointD location,
PointD distance)
Determines whether a given handle has been visually hit by the touch device at the given world coordinates.
|
void |
install(IInputModeContext context,
ConcurrencyController controller)
Installs the visual representation of the handles into the canvas into the
InputModeGroup . |
protected void |
invalidate()
Convenience method that invalidates the canvas this mode is currently installed in.
|
boolean |
isEnabled()
Gets the enabled state of this input mode.
|
boolean |
isExclusive()
Gets a value indicating whether this mode will be the only one running when it has the mutex.
|
protected boolean |
isHovering(Object sender,
IEventArgs args)
Event recognizer callback used to determine whether the mouse is currently hovering over a handle.
|
protected void |
onCanceled()
Called after
cancel() has been called. |
protected void |
onConcurrencyControllerActivated()
|
protected void |
onConcurrencyControllerDeactivated()
|
protected void |
onDragCanceled(InputModeEventArgs inputModeEventArgs)
Triggers the
DragCanceled event. |
protected void |
onDragCanceling(InputModeEventArgs inputModeEventArgs)
Triggers the
DragCanceling event. |
protected void |
onDragFinished(InputModeEventArgs inputModeEventArgs)
Callback triggered once the drag has been finalized.
|
protected void |
onDragFinishing(InputModeEventArgs inputModeEventArgs)
Callback triggered before the drag will be finalized.
|
protected void |
onDragged(InputModeEventArgs inputModeEventArgs)
Callback triggered at the end of each drag.
|
protected void |
onDragging(InputModeEventArgs inputModeEventArgs)
Callback triggered at the start of each drag.
|
protected void |
onDragStarted(InputModeEventArgs inputModeEventArgs)
Triggers the
DragStarted event. |
protected void |
onDragStarting(InputModeEventArgs inputModeEventArgs)
Triggers the
DragStarting event. |
protected void |
onStopped()
Called after
stop() has been called. |
void |
removeDragCanceledListener(IEventHandler<InputModeEventArgs> dragCanceledEvent)
Removes the given listener for the
DragCanceled event that occurs when the drag has been canceled. |
void |
removeDragCancelingListener(IEventHandler<InputModeEventArgs> dragCancelingEvent)
Removes the given listener for the
DragCanceling event that occurs before the drag will be canceled. |
void |
removeDragFinishedListener(IEventHandler<InputModeEventArgs> dragFinishedEvent)
Removes the given listener for the
DragFinished event that occurs once the drag has been finished. |
void |
removeDragFinishingListener(IEventHandler<InputModeEventArgs> dragFinishingEvent)
Removes the given listener for the
DragFinishing event that occurs before the drag will be finished. |
void |
removeDraggedListener(IEventHandler<InputModeEventArgs> draggedEvent)
Removes the given listener for the
Dragged event that occurs at the end of every drag. |
void |
removeDraggingListener(IEventHandler<InputModeEventArgs> draggingEvent)
Removes the given listener for the
Dragging event that occurs at the start of every drag. |
void |
removeDragStartedListener(IEventHandler<InputModeEventArgs> dragStartedEvent)
Removes the given listener for the
DragStarted event that occurs once the drag is initialized and has started. |
void |
removeDragStartingListener(IEventHandler<InputModeEventArgs> dragStartingEvent)
Removes the given listener for the
DragStarting event that occurs once the drag is starting. |
void |
removeHandle(IHandle handle)
Removes a handle from the collection of handles managed by this instance.
|
void |
setCancelRecognizer(IEventRecognizer value)
Sets the "cancel" recognizer.
|
void |
setDisableSnappingRecognizer(IEventRecognizer value)
Sets event recognizer that recognizes when the user temporarily disables snapping.
|
void |
setDraggedRecognizer(IEventRecognizer value)
Sets the "dragged" recognizer.
|
void |
setDraggedRecognizerTouch(IEventRecognizer value)
Sets the "dragged" recognizer for touch input.
|
void |
setEnabled(boolean value)
Sets the enabled state of this input mode.
|
void |
setEnableSnappingRecognizer(IEventRecognizer value)
Sets event recognizer that recognizes when the user reenables temporarily disabled snapping.
|
void |
setExclusive(boolean value)
Sets a value indicating whether this mode will be the only one running when it has the mutex.
|
void |
setHandles(IObservableCollection<IHandle> value)
Sets the collection of
IHandle s this mode manages. |
void |
setPressedRecognizer(IEventRecognizer value)
Sets the "pressed" state recognizer.
|
void |
setPressedRecognizerTouch(IEventRecognizer value)
Sets the "pressed" state recognizer for touch input.
|
void |
setPriority(int value)
The priority of this input mode.
|
void |
setReleasedRecognizer(IEventRecognizer value)
Sets the "released" recognizer.
|
void |
setReleasedRecognizerTouch(IEventRecognizer value)
Sets the "released" recognizer for touch input.
|
void |
setSnapContext(SnapContext value)
The
SnapContext which manages snapping model items to certain coordinates (for instance, other
items). |
boolean |
stop()
Called by the client in order to stop a current editing progress.
|
void |
uninstall(IInputModeContext context)
Removes the
ICanvasObject that displays the handles from the canvas. |
public static final ResourceKey HANDLE_DRAWING_DEFAULT_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.DEFAULT
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_DEFAULT_VARIANT2_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HHandleTypes.DEFAULT
|
HandleTypes.VARIANT2
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_DEFAULT_VARIANT3_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.DEFAULT
|
HandleTypes.VARIANT3
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_DEFAULT_VARIANT4_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.DEFAULT
|
HandleTypes.VARIANT4
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_INVISIBLE_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.INVISIBLE
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_INVISIBLE_VARIANT2_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.INVISIBLE
|
HandleTypes.VARIANT2
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_INVISIBLE_VARIANT3_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.INVISIBLE
|
HandleTypes.VARIANT3
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_INVISIBLE_VARIANT4_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.INVISIBLE
|
HandleTypes.VARIANT4
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_MOVE_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.MOVE
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_MOVE_VARIANT2_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.MOVE
|
HandleTypes.VARIANT2
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_MOVE_VARIANT3_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.MOVE
|
HandleTypes.VARIANT3
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_MOVE_VARIANT4_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.MOVE
|
HandleTypes.VARIANT4
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_RESIZE_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.RESIZE
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_RESIZE_VARIANT2_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.RESIZE
|
HandleTypes.VARIANT2
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_RESIZE_VARIANT3_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.RESIZE
|
HandleTypes.VARIANT3
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_RESIZE_VARIANT4_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.RESIZE
|
HandleTypes.VARIANT4
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_ROTATE_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.ROTATE
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_ROTATE_VARIANT2_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.ROTATE
|
HandleTypes.VARIANT2
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_ROTATE_VARIANT3_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.ROTATE
|
HandleTypes.VARIANT3
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_ROTATE_VARIANT4_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.ROTATE
|
HandleTypes.VARIANT4
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_SHEAR_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.SHEAR
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_SHEAR_VARIANT2_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.SHEAR
|
HandleTypes.VARIANT2
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_SHEAR_VARIANT3_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.SHEAR
|
HandleTypes.VARIANT3
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_SHEAR_VARIANT4_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.SHEAR
|
HandleTypes.VARIANT4
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_WARP_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.WARP
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_WARP_VARIANT2_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.WARP
|
HandleTypes.VARIANT2
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_WARP_VARIANT3_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.WARP
|
HandleTypes.VARIANT3
.
The drawing returned should be centered around (0,0)
.
public static final ResourceKey HANDLE_DRAWING_WARP_VARIANT4_KEY
ResourceKey
that can be used by instances of the HandleInputMode
to look up a IVisualTemplate
that will be used for the rendering of IHandle
s of type
HandleTypes.WARP
|
HandleTypes.VARIANT4
.
The drawing returned should be centered around (0,0)
.
public HandleInputMode()
getHandles()
public final void addDragCanceledListener(IEventHandler<InputModeEventArgs> dragCanceledEvent)
DragCanceled
event that occurs when the drag has been canceled.dragCanceledEvent
- The listener to add.removeDragCanceledListener(IEventHandler)
public final void addDragCancelingListener(IEventHandler<InputModeEventArgs> dragCancelingEvent)
DragCanceling
event that occurs before the drag will be canceled.dragCancelingEvent
- The listener to add.removeDragCancelingListener(IEventHandler)
public final void addDragFinishedListener(IEventHandler<InputModeEventArgs> dragFinishedEvent)
DragFinished
event that occurs once the drag has been finished.dragFinishedEvent
- The listener to add.removeDragFinishedListener(IEventHandler)
public final void addDragFinishingListener(IEventHandler<InputModeEventArgs> dragFinishingEvent)
DragFinishing
event that occurs before the drag will be finished.dragFinishingEvent
- The listener to add.removeDragFinishingListener(IEventHandler)
public final void addDraggedListener(IEventHandler<InputModeEventArgs> draggedEvent)
Dragged
event that occurs at the end of every drag.draggedEvent
- The listener to add.removeDraggedListener(IEventHandler)
public final void addDraggingListener(IEventHandler<InputModeEventArgs> draggingEvent)
Dragging
event that occurs at the start of every drag.draggingEvent
- The listener to add.removeDraggingListener(IEventHandler)
public final void addDragStartedListener(IEventHandler<InputModeEventArgs> dragStartedEvent)
DragStarted
event that occurs once the drag is initialized and has started.dragStartedEvent
- The listener to add.removeDragStartedListener(IEventHandler)
public final void addDragStartingListener(IEventHandler<InputModeEventArgs> dragStartingEvent)
DragStarting
event that occurs once the drag is starting.dragStartingEvent
- The listener to add.removeDragStartingListener(IEventHandler)
public final void addHandle(IHandle handle)
handle
- The handle to add.public final IHandle addHandle(IMutablePoint location)
adds
a handle to this mode by wrapping a given IMutablePoint
instance.
The cursor
and type
are used to initialize the IHandle
instance.
location
- The point to use as a handle.public final IHandle addHandle(IMutablePoint location, Cursor cursor)
adds
a handle to this mode by wrapping a given IMutablePoint
instance.
The cursor
and type
are used to initialize the IHandle
instance.
location
- The point to use as a handle.cursor
- The cursor to use.public final IHandle addHandle(IMutablePoint location, Cursor cursor, HandleTypes type)
adds
a handle to this mode by wrapping a given IMutablePoint
instance.
The cursor
and type
are used to initialize the IHandle
instance.
location
- The point to use as a handle.cursor
- The cursor to use.type
- The type of the handle to create.protected void arm(IHandle handle)
This happens when the mouse pointer hovers over a handle. This changes the mouse cursor to the handle
's
Cursor
.
public void beginDragging(IHandle handle)
This will simulate the user having initialized a drag of the given handle.
handle
- The handle to be dragged.public void cancel()
IInputMode
This will be called prior to the uninstalling of this instance.
In order to stop an active input mode manually, client code should use the following idiom:
cancel
in interface IInputMode
protected IInputModeContext createHandleInputModeContext()
IInputModeContext
for use with the IHandle
interface for the upcoming drag operation.IInputModeContext
.protected InputModeEventArgs createInputModeEventArgs()
InputModeEventArgs
for this input mode.protected Node createVisual(IRenderContext context, IHandle handle)
Node
for the given handle.context
- The render context the visual shall be created in.handle
- The handle to create a visual representation for.Node
.protected void disarm()
This happens when the mouse stops hovering over a handle. This resets the mouse cursor
public final IEnumerable<IModelItem> getAffectedItems()
IModelItem
s affected by the currently modified handle
gesture.
When the gesture is starting
and the CurrentHandle
is initialized
, the implementation
can register
the affected item(s) through the IModelItemCollector
instance that is bound to the context
available via its
ILookup.lookup(Class)
.
Client code can register with the DragStarted
event, as well as the DragFinished
event to get notified of the elements that may be or have been affected respectively by this input mode.
public final IEventRecognizer getCancelRecognizer()
This recognizer recognizes the cancel action during the move.
setCancelRecognizer(IEventRecognizer)
protected IHandle getClosestHitHandle(PointD location)
The default implementation compares the manhatten distance of the handles to find the closest handle.
location
- The coordinates in the world coordinate system.null
protected IHandle getClosestHitHandleTouch(PointD location)
location
- The coordinates in the world coordinate system.null
protected final ConcurrencyController getController()
Controller
.public final IHandle getCurrentHandle()
null
otherwise.null
.public final IEventRecognizer getDisableSnappingRecognizer()
IEventRecognizer.SHORTCUT_DOWN
getEnableSnappingRecognizer()
,
setDisableSnappingRecognizer(IEventRecognizer)
public final IEventRecognizer getDraggedRecognizer()
This recognizer instance determines when the user is moving a handle.
setDraggedRecognizer(IEventRecognizer)
public final IEventRecognizer getDraggedRecognizerTouch()
This recognizer instance determines when the user is moving a handle.
setDraggedRecognizerTouch(IEventRecognizer)
public final IEventRecognizer getEnableSnappingRecognizer()
IEventRecognizer.SHORTCUT_UP
setEnableSnappingRecognizer(IEventRecognizer)
public final IObservableCollection<IHandle> getHandles()
IHandle
s this mode manages.setHandles(IObservableCollection)
public final IInputModeContext getInputModeContext()
IInputMode
null
if this instance is not installed.
Note that this instance should not be passed down to subordinate modes or instances. Instead a corresponding context
that has this instance set as the ParentInputMode
should be used.
getInputModeContext
in interface IInputMode
public final IEventRecognizer getPressedRecognizer()
This recognizer instance will be used to determine when the user begins to move a handle.
setPressedRecognizer(IEventRecognizer)
public final IEventRecognizer getPressedRecognizerTouch()
This recognizer instance will be used to determine when the user begins to move a handle.
setPressedRecognizerTouch(IEventRecognizer)
public final int getPriority()
IInputMode
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
getPriority
in interface IInputMode
public final IEventRecognizer getReleasedRecognizer()
This instance determines when the user has finished moving the handle.
setReleasedRecognizer(IEventRecognizer)
public final IEventRecognizer getReleasedRecognizerTouch()
This instance determines when the user has finished moving the handle.
setReleasedRecognizerTouch(IEventRecognizer)
public final SnapContext getSnapContext()
SnapContext
which manages snapping model items to certain coordinates (for instance, other
items).
If set to null
(the default) this input mode tries to obtain the SnapContext
from the
IInputModeContext
. To explicitly disable snapping, a SnapContext
implementation
that does nothing has to be set to this instance.
setSnapContext(SnapContext)
protected boolean handleIsHit(IHandle handle, PointD location, PointD distance)
This implementation uses the manhatten distance as a metric to determine if the handle was hit.
handle
- The handle to checklocation
- The view coordinates to check.distance
- The distance of the handle to the location. In the default implementation, this is a tuple representing the x- and
y-distance of the handle to the location.protected boolean handleIsHitTouch(IHandle handle, PointD location, PointD distance)
handle
- The handle to checklocation
- The world coordinates to check.distance
- The distance of the handle to the touch location. In the default implementation, this is a tuple representing the x- and
y-distance of the handle to the touch location.public void install(IInputModeContext context, ConcurrencyController controller)
InputModeGroup
.install
in interface IInputMode
context
- The context that this instance shall be installed into. The same instance will be passed to this instance during
IInputMode.uninstall(IInputModeContext)
. A reference to the context may be kept and queried during the time the mode
is installed.controller
- The ConcurrencyController
for this mode.IInputMode.uninstall(IInputModeContext)
protected final void invalidate()
public boolean isEnabled()
Clients can use this property to disable or reenable this instance. This will set the Enabled
property of the installed Controller
so a disabled instance should never try to acquire the
input mutex.
Disabling this mode will hide the handles and prevent the user from interacting with them.
setEnabled(boolean)
public final boolean isExclusive()
The value of this property will be delegated to the Exclusive
property of
the Controller
.
If this mode is marked as exclusive and has the mutex, all other modes added
to the same MultiplexingInputMode
will be deactivated. Otherwise it will always run
concurrently with all other modes.
setExclusive(boolean)
protected boolean isHovering(Object sender, IEventArgs args)
getClosestHitHandle(PointD)
protected void onCanceled()
cancel()
has been called.
Can be overridden in subclasses to perform additional actions after the mode has been canceled.
This implementation does nothing.
protected void onConcurrencyControllerActivated()
Active
property of the installed ConcurrencyController
has been set to true
.
Can be overridden in subclasses to perform additional actions after the mode has been activated.
Overriding implementations should call the base implementation.
protected void onConcurrencyControllerDeactivated()
Active
property of the installed ConcurrencyController
has been set to false
.
Can be overridden in subclasses to perform additional actions after the mode has been deactivated.
Overriding implementations should call the base implementation.
protected void onDragCanceled(InputModeEventArgs inputModeEventArgs)
DragCanceled
event.inputModeEventArgs
- The event argument that contains context information.protected void onDragCanceling(InputModeEventArgs inputModeEventArgs)
DragCanceling
event.inputModeEventArgs
- The event argument that contains context information.protected void onDragFinished(InputModeEventArgs inputModeEventArgs)
This method triggers the DragFinished
event.
inputModeEventArgs
- The event argument that contains context information.protected void onDragFinishing(InputModeEventArgs inputModeEventArgs)
This method triggers the DragFinishing
event.
inputModeEventArgs
- The event argument that contains context information.protected void onDragged(InputModeEventArgs inputModeEventArgs)
This method triggers the Dragged
event.
inputModeEventArgs
- The event argument that contains context information.protected void onDragging(InputModeEventArgs inputModeEventArgs)
This method triggers the Dragging
event.
inputModeEventArgs
- The event argument that contains context information.protected void onDragStarted(InputModeEventArgs inputModeEventArgs)
DragStarted
event.inputModeEventArgs
- The event argument that contains context information.protected void onDragStarting(InputModeEventArgs inputModeEventArgs)
DragStarting
event.inputModeEventArgs
- The event argument that contains context information.protected void onStopped()
stop()
has been called.
Can be overridden in subclasses to perform additional actions after the mode has been stopped.
This implementation does nothing.
public final void removeDragCanceledListener(IEventHandler<InputModeEventArgs> dragCanceledEvent)
DragCanceled
event that occurs when the drag has been canceled.dragCanceledEvent
- The listener to remove.addDragCanceledListener(IEventHandler)
public final void removeDragCancelingListener(IEventHandler<InputModeEventArgs> dragCancelingEvent)
DragCanceling
event that occurs before the drag will be canceled.dragCancelingEvent
- The listener to remove.addDragCancelingListener(IEventHandler)
public final void removeDragFinishedListener(IEventHandler<InputModeEventArgs> dragFinishedEvent)
DragFinished
event that occurs once the drag has been finished.dragFinishedEvent
- The listener to remove.addDragFinishedListener(IEventHandler)
public final void removeDragFinishingListener(IEventHandler<InputModeEventArgs> dragFinishingEvent)
DragFinishing
event that occurs before the drag will be finished.dragFinishingEvent
- The listener to remove.addDragFinishingListener(IEventHandler)
public final void removeDraggedListener(IEventHandler<InputModeEventArgs> draggedEvent)
Dragged
event that occurs at the end of every drag.draggedEvent
- The listener to remove.addDraggedListener(IEventHandler)
public final void removeDraggingListener(IEventHandler<InputModeEventArgs> draggingEvent)
Dragging
event that occurs at the start of every drag.draggingEvent
- The listener to remove.addDraggingListener(IEventHandler)
public final void removeDragStartedListener(IEventHandler<InputModeEventArgs> dragStartedEvent)
DragStarted
event that occurs once the drag is initialized and has started.dragStartedEvent
- The listener to remove.addDragStartedListener(IEventHandler)
public final void removeDragStartingListener(IEventHandler<InputModeEventArgs> dragStartingEvent)
DragStarting
event that occurs once the drag is starting.dragStartingEvent
- The listener to remove.addDragStartingListener(IEventHandler)
public final void removeHandle(IHandle handle)
handle
- The handle to remove.public final void setCancelRecognizer(IEventRecognizer value)
This recognizer recognizes the cancel action during the move.
value
- The "cancel" recognizer.getCancelRecognizer()
public final void setDisableSnappingRecognizer(IEventRecognizer value)
value
- The instance to use for disabling snapping. The default is IEventRecognizer.SHORTCUT_DOWN
getEnableSnappingRecognizer()
,
getDisableSnappingRecognizer()
public final void setDraggedRecognizer(IEventRecognizer value)
This recognizer instance determines when the user is moving a handle.
value
- The "dragged" recognizer.getDraggedRecognizer()
public final void setDraggedRecognizerTouch(IEventRecognizer value)
This recognizer instance determines when the user is moving a handle.
value
- The "dragged" recognizer for touch events.getDraggedRecognizerTouch()
public void setEnabled(boolean value)
Clients can use this property to disable or reenable this instance. This will set the Enabled
property of the installed Controller
so a disabled instance should never try to acquire the
input mutex.
Disabling this mode will hide the handles and prevent the user from interacting with them.
value
- The Enabled to set.isEnabled()
public final void setEnableSnappingRecognizer(IEventRecognizer value)
value
- The instance to use for reenabling snapping. The default is IEventRecognizer.SHORTCUT_UP
getEnableSnappingRecognizer()
public final void setExclusive(boolean value)
The value of this property will be delegated to the Exclusive
property of
the Controller
.
If this mode is marked as exclusive and has the mutex, all other modes added
to the same MultiplexingInputMode
will be deactivated. Otherwise it will always run
concurrently with all other modes.
value
- The Exclusive to set.isExclusive()
public final void setHandles(IObservableCollection<IHandle> value)
IHandle
s this mode manages.value
- The Handles to set.getHandles()
public final void setPressedRecognizer(IEventRecognizer value)
This recognizer instance will be used to determine when the user begins to move a handle.
value
- The "pressed" recognizer.getPressedRecognizer()
public final void setPressedRecognizerTouch(IEventRecognizer value)
This recognizer instance will be used to determine when the user begins to move a handle.
value
- The "pressed" recognizer for touch events.getPressedRecognizerTouch()
public final void setPriority(int value)
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
value
- The Priority to set.getPriority()
public final void setReleasedRecognizer(IEventRecognizer value)
This instance determines when the user has finished moving the handle.
value
- The "released" recognizer.getReleasedRecognizer()
public final void setReleasedRecognizerTouch(IEventRecognizer value)
This instance determines when the user has finished moving the handle.
value
- The "released" recognizer for touch events.getReleasedRecognizerTouch()
public final void setSnapContext(SnapContext value)
SnapContext
which manages snapping model items to certain coordinates (for instance, other
items).
If set to null
(the default) this input mode tries to obtain the SnapContext
from the
IInputModeContext
. To explicitly disable snapping, a SnapContext
implementation
that does nothing has to be set to this instance.
value
- The SnapContext to set.getSnapContext()
public boolean stop()
IInputMode
This should stop the current edit, if one is in progress and possibly commit all of the changes. If stopping is not
possible, this method can return false
stop
in interface IInputMode
true
if and only if the editing has been stopped or there was no edit in progressIInputMode.cancel()
public void uninstall(IInputModeContext context)
ICanvasObject
that displays the handles from the canvas.uninstall
in interface IInputMode
context
- The context to deregister from. This is the same instance that had been passed to IInputMode.install(IInputModeContext, ConcurrencyController)
during installation.