C

CreateBendInputMode

An IInputMode used for recognizing the gesture of creating IBends in an IGraph.
ImplementsInheritance Hierarchy

Remarks

This mode is used by GraphEditorInputMode but can be used stand-alone, too. Client code should register with the bend-created event to perform additional actions after the bend has been created.

This mode is exclusive by default.

Examples

Typically the CreateBendInputMode is installed as child mode of a GraphEditorInputMode and can be retrieved from the createBendInputMode property.
Getting the CreateBendInputMode from its parent input mode
const createBendInputMode = mode.createBendInputMode

Members

Show:

Constructors

Creates a new instance that will use the IGraph from the parentInputModeContext to create bends in.

Parameters

See Also

API
graph

Properties

Gets or sets the cursor to use when this mode is in "armed" state.
conversionfinal
Gets or sets the IHitTestable that determines where bends may be created.
final
Gets or sets the event recognizer that determines when the user begins bend creation.
The default recognizer detects MOUSE or PEN DOWN events.
final
Gets or sets an event recognizer that determines when the user begins bend creation via TOUCH input.
The default recognizer is TOUCH_PRIMARY_LONG_PRESS.
final
Gets the installed controller.
protectedreadonlyfinal
Gets or sets the enabled state of this input mode.
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.

Examples

Disabling the CreateBendInputMode on its parent input mode
mode.createBendInputMode.enabled = false
Note that in order to disable interactive bend creation one has to disable bend creation during edge creation, too:
Disabling the bend creation during edge creation and on existing edges
// mode is an instance of GraphEditorInputMode
mode.createBendInputMode.enabled = false
mode.createEdgeInputMode.allowCreateBend = false
Gets or sets a value indicating whether this mode will be the only one running when it has the mutex.

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.

final
Gets or sets the event recognizer that determines when the user has finished bend creation.
final
Gets or sets the event recognizer that determines when the user has finished bend creation via TOUCH input.
The default recognizer is TOUCH_PRIMARY_UP.
final
Gets the graph this mode is acting upon.
readonlyfinal
Gets the location where the bend creation gesture was initialized.
readonlyfinal
Gets or sets the event recognizer that determines when the user is moving the new bend.
The default recognizer is MOUSE_DRAG.
final
Gets or sets the event recognizer that determines when the user moves the new bend via TOUCH input.
The default recognizer is TOUCH_PRIMARY_DRAG.
final
Retrieves the IInputModeContext this mode has been installed in.
The value will be null if this mode is currently not installed. Use createInputModeContext to obtain a context that has this IInputMode as the inputMode.
protectedreadonlyfinal
Gets the priority of this input mode.
The priority will influence the order in which the modes will be installed into the CanvasComponent. The lower the priority value, the earlier it will be installed. If two modes are using the same priority value, the first one to be registered will be installed earlier.
final
Gets or sets a value indicating whether an orthogonal segment should be split by the last bend creation.
This property can be read by implementations of IBendCreator if they retrieve this instance from their inputMode. If this property is true, implementations are advised to treat the bend creation as a gesture that splits the segment into two.
final

See Also

API
splitOrthogonalSegmentRecognizer
Gets or sets an event recognizer that determines whether the bend creation should be treated as a split segment operation.
final

Property Value

The event recognizer that determines whether orthogonal edge segments should be split during the bend creation.
Gets or sets a property that determines whether this mode should use an existing bend in createBend if there is one found at the given location.
The default is true
final
Gets or sets the event recognizer that determines whether the current location is valid to begin a bend creation gesture.
The default recognizer is ALWAYS.
final

See Also

API
beginHitTestable

Methods

Called when a bend creation gesture can be started at the current mouse pointer location.
This implementation sets the preferredCursor to armedCursor.
protected
Cancels the editing of this mode.
This implementation releases the mutex if it is currently owned by this instance and calls onCanceled.

See Also

API
onCanceled
Creates the bend.
The bend is created using the hit edge's IBendCreator implementation, as obtained from the edge's lookup.
protected

Parameters

edge: IEdge
The hit edge.
location: Point
The coordinates of the hit.

Return Value

IBend
The created bend or null.

See Also

API
createInputModeContext
Creates an IInputModeContext for use with the upcoming createBend call in createBend.
Creates an implementation of IInputModeContext that is specific to this mode.

This is needed for events that are triggered by this InputMode to signal where the event is coming from. A common usage for this is, for example, in isHit calls.

The result can be given to isHit or enumerateHits to let implementations of IHitTestable get access to the current IInputModeContext. This can be done by looking up IInputModeContext from the ICanvasContext's lookup method or simply downcasting.

protected

Return Value

IInputModeContext
A readily configured IInputModeContext.

See Also

API
enumerateHits, isHit, IInputModeContext
Called when a bend creation gesture can no longer be started at the current mouse pointer location.
This implementation sets the preferredCursor back to null.
protected
Updates the splitOrthogonalSegment property and then delegates to createBend.
This method triggers the bend-created event if a bend is created.
protected

Parameters

edge: IEdge
The edge to create a bend for.
dragLocation: Point
The location at which the user initiated the gesture.
Finds the edge at the given coordinates.
protected

Parameters

location: Point
The coordinates.

Return Value

IEdge
The edge that has been hit.
Installs this mode into the given context that is provided by the canvas.

In general a mode can only be installed into a single canvas at all times.

This method is called to initialize this instance. Subclasses should override this method to register the corresponding event handler delegates for the various input events they need to register with.

Overriding implementations should call the base implementation, first.

Parameters

context: IInputModeContext
The context that this instance shall be installed into. The same instance will be passed to this instance during uninstall. A reference to the context may be kept and queried during the time the mode is installed.
controller: ConcurrencyController
The controller for this mode.

See Also

API
uninstall
Triggers the bend-created event.
protected

Parameters

evt: InputModeItemEventArgs<IBend>
The event argument holding the bend.
Called after cancel has been called.

Can be overridden in subclasses to perform additional actions after the mode has been canceled.

This implementation does nothing.

protected
Called after the 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
Called after the 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
Triggers the drag-canceled event.
protected

Parameters

evt: InputModeEventArgs
The event argument that contains context information.
Triggered at the end of each drag.
This method triggers the dragged event.
protected

Parameters

evt: InputModeEventArgs
The event argument that contains context information.
Triggered at the start of each drag.
This method triggers the dragging event.
protected

Parameters

evt: InputModeEventArgs
The event argument that contains context information.
Called after tryStop has been called.

Can be overridden in subclasses to perform additional actions after the mode has been stopped.

This implementation does nothing.

protected
Will be called to request a stop of the current editing progress.
This should stop the current edit, if one is in progress, and possibly commit all pending changes. If stopping is not possible, this method can return false

Return Value

boolean
true if and only if the editing has been stopped or there was no edit in progress
Uninstalls this mode from the given context.

This code should clean up all changes made to the canvas in the install method. After a mode has been uninstalled it can be installed again into the same or another canvas.

Overriding implementations should call the base implementation after their own code.

Parameters

context: IInputModeContext
The context to deregister from. This is the same instance that had been passed to install during installation.

Events

Occurs once a bend has been interactively created by this input mode.
context: IInputModeContext
Gets the context for the current event.
item: TModelItem
Gets the item which has been created or changed.
Occurs when the drag has been canceled.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.
Occurs at the end of every drag.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.
Occurs at the start of every drag.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.