Abstract base class for GraphViewerInputMode and GraphEditorInputMode.
Remarks
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.GraphInputMode
Properties
Gets a collection of commands that this input mode will handle.
Remarks
Gets or sets which types of items should be reported through the item click events.
Remarks
This also affects taps.
The default is ALL.
Examples
mode.clickableItems = GraphItemTypes.NODE | GraphItemTypes.EDGE
See Also
Gets or sets the order of the types of items that should be used to determine what item has been clicked or tapped.
Remarks
Change this field to adjust which items will be selected if there are multiple items at a given location. The default order is
Arrays that contain strings describing the name of GraphItemTypes are converted to an array of GraphItemTypes. For example:
['node', 'edge']
['NODE', 'EDGE']
Examples
mode.clickHitTestOrder = [
GraphItemTypes.BEND,
GraphItemTypes.NODE | GraphItemTypes.EDGE,
GraphItemTypes.LABEL
]
See Also
Gets or sets the ClickInputMode that is used by this instance to determine clicks.
Remarks
Whenever the mode detects a click, this mode will use the IHitTester<T> from the inputModeContext to determine the items being hit. If they match the clickableItems type, the ItemClicked event will be triggered. If they shouldFocus, the item will be set as the current item.
If no value has been set explicitly, the factory method createClickInputMode will be called upon first access. Upon change the onClickInputModeChanged method will be called.
By default this input mode has a priority of 10
.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
See Also
Gets or sets which types of items should be selectable by mouse clicks.
Gets or sets the ContextMenuInputMode which handles context menus on a CanvasComponent.
Remarks
If no value has been set explicitly, the factory method createContextMenuInputMode will be called upon first access. Upon change the onContextMenuInputModeChanged method will be called.
By default this input mode has a priority of 60
.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
ContextMenuInputMode
. This involves registering for the PopulateItemContextMenu event instead of the PopulateMenu event:// mode is either an instance of GraphEditorInputMode or GraphViewerInputMode
mode.contextMenuItems = GraphItemTypes.NODE
mode.addPopulateItemContextMenuListener((sender, args) => {
// Get the node which is handled or null if the item is not a node
const node = args.item
// Create the context menu items
if (node !== null) {
// Create a menu item to delete the node
// Show the menu
args.showMenu = true
// Mark the event as handled
args.handled = true
}
})
Gets or sets the types of items a context menu should be queried for.
Remarks
Examples
// mode is either an instance of GraphEditorInputMode or GraphViewerInputMode
mode.contextMenuItems = GraphItemTypes.NODE
mode.addPopulateItemContextMenuListener((sender, args) => {
// Get the node which is handled or null if the item is not a node
const node = args.item
// Create the context menu items
if (node !== null) {
// Create a menu item to delete the node
// Show the menu
args.showMenu = true
// Mark the event as handled
args.handled = true
}
})
Gets the installed controller.
Defined in
Gets or sets the event recognizer that determines if a click should cycle through all the items that are currently under the mouse cursor.
Remarks
If the recognizer determines that the user wanted to use the cyclic click selection behavior, the hitTester will be queried for the given item and previously reported items will be ignored. E.g. if multiple nodes are overlapping each other, clicking on them will report the first item for the first click, the second one for the second click and so on. If all elements have been reported previously, the first one is going to be reported again. If the order of the elements at the clicked location changes, the cyclic selection is restarted anew.
The default is ALT_IS_DOWN.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Sample Graphs
Gets or sets the cursor to use whenever no child mode prefers a different cursor.
Remarks
null
See Also
Defined in
Gets or sets the event recognizer that determines if a click should select the item that is currently visible under the mouse cursor, without giving more important items higher priority.
Remarks
If the recognizer determines that the user wanted to use the detail clicking behavior, the hitTester will be queried for the given item and the first item that is returned will be considered a hit. Otherwise all hit items are examined and are prioritized by item type. E.g. by default clicking on a node will select the node, even if there is a node label which has been clicked at the same point. If detail selection is recognized, the label will be selected.
The default is SHIFT_IS_DOWN.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Examples
mode.detailSelectionRecognizer = KeyEventRecognizers.SHIFT_IS_DOWN
Sample Graphs
Gets or sets the order of the types of items that should be used to determine what item has been double-clicked or double-tapped.
Remarks
Change this field to adjust which items will be considered when double-clicked if there are multiple items at a given location. The default order is
Arrays that contain strings describing the name of GraphItemTypes are converted to an array of GraphItemTypes. For example:
['node', 'edge']
['NODE', 'EDGE']
Examples
mode.doubleClickHitTestOrder = [
GraphItemTypes.BEND,
GraphItemTypes.NODE | GraphItemTypes.EDGE,
GraphItemTypes.LABEL
]
See Also
Gets or sets the enabled state of this input mode.
Remarks
Defined in
Gets or sets a value indicating whether this mode will be the only one running when it has the mutex.
Remarks
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.
Defined in
Gets or sets the items that can be given focus via the setCurrentItem method.
Remarks
Examples
mode.focusableItems = GraphItemTypes.NODE | GraphItemTypes.EDGE
Gets the graph instance from the inputModeContext.
Gets the graph selection from the inputModeContext.
Gets or sets a value indicating whether void styles (VoidNodeStyle, VoidEdgeStyle, VoidLabelStyle, and VoidPortStyle) should be ignored when selecting or focusing items.
Remarks
false
the invisible elements are not selectable by mouse clicks or marquee selection since their hit testable always returns false
.Gets the context instance this mode is currently installed in or null
if this instance is not installed.
Remarks
Implements
Gets or sets the ItemHoverInputMode that is provided by this instance to detect when the cursor hovers over a graph item.
Remarks
Note that initially the hoverItems property is set to NONE, which effectively disables the functionality of the mode initially. In order to get the mode to fire events, the property should be set to a corresponding value.
If the backing field has not yet been initialized upon first access, the factory method createItemHoverInputMode will be called. Upon change the onItemHoverInputModeChanged method will be called.
By default this input mode has a priority of 55
.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
null
. One can also configure the item types which are reported:Gets or sets the KeyboardInputMode associated with this instance.
Remarks
0
.Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
Gets or sets the LassoSelectionInputMode which handles the selection of multiple elements by drawing a polygon around them.
Remarks
If no value has been set explicitly, the factory method createLassoSelectionInputMode will be called upon first access. Upon change the onLassoSelectionInputModeChanged method will be called.
The lassoSelectionInputMode respects the selectableItems and the marqueeSelectableItems as well as method shouldMarqueeSelect.
By default this input mode has a priority of 49
and is disabled.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Gets or sets which types of items should be selected during marquee selections or lasso selection.
Remarks
Examples
See Also
Gets or sets the MarqueeSelectionInputMode which handles the selection of multiple elements by drawing a rectangle around them.
Remarks
If no value has been set explicitly, the factory method createMarqueeSelectionInputMode will be called upon first access. Upon change the onMarqueeSelectionInputModeChanged method will be called.
The marqueeSelectionInputMode respects the selectableItems and the marqueeSelectableItems as well as method shouldMarqueeSelect.
By default this input mode has a priority of 50
.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
Gets or sets the MouseHoverInputMode which is responsible for displaying Tooltips on a CanvasComponent.
Remarks
If no value has been set explicitly, the factory method createMouseHoverInputMode will be called upon first access. Upon change the onMouseHoverInputModeChanged method will be called.
By default this input mode has a priority of 100
.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
MouseHoverInputMode
. This involves registering for the QueryItemToolTip event instead of the QueryToolTip event:// mode is either an instance of GraphEditorInputMode or GraphViewerInputMode
mode.toolTipItems = GraphItemTypes.NODE
// register a listener
mode.addQueryItemToolTipListener((src, args) => {
if (args.handled) {
// A tooltip has already been assigned -> nothing to do.
return
}
// We can safely cast here because we set ToolTipItems to only Node.
const hitNode = args.item
if (hitNode.labels.size > 0) {
// Show the text of the first label as tooltip.
args.toolTip = hitNode.labels.get(0).text
// Indicate that the tooltip content has been set.
args.handled = true
}
})
// mode is either an instance of GraphEditorInputMode or GraphViewerInputMode
mode.toolTipItems = GraphItemTypes.NODE
// register a listener
mode.addQueryItemToolTipListener((src, args) => {
if (args.handled) {
// A tooltip has already been assigned -> nothing to do.
return
}
// We can safely cast here because we set ToolTipItems to only Node.
const hitNode = args.item as INode
if (hitNode.labels.size > 0) {
// Show the text of the first label as tooltip.
args.toolTip = hitNode.labels.get(0).text
// Indicate that the tooltip content has been set.
args.handled = true
}
})
Gets or sets the MoveViewportInputMode associated with this instance.
Remarks
If no value has been set explicitly, the factory method createMoveViewportInputMode will be called upon first access. Upon change the onMoveViewportInputModeChanged method will be called.
By default this input mode has a priority of 39
.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
Gets or sets the event recognizer that determines if a click is deemed a multi selection gesture.
Remarks
If the multiSelectionRecognizer returns true
for the current gesture the element which is selected with that gesture will be added to the current selection. Otherwise, the selection will be cleared before adding the newly selected element.
The default is an or-combination of CTRL_IS_DOWN and META_IS_DOWN.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Gets the IInputMode that currently owns the mutex.
Defined in
Gets the priority of this input mode.
Remarks
See Also
Implements
Gets or sets which types of items should be selectable at all.
Gets or sets a predicate that is queried to determine whether a given IModelItem is selectable.
Remarks
null
the effect is the same as a predicate that always returns true
.Signature Details
function(obj: IModelItem) : boolean
Parameters
- obj - IModelItem
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
Examples
mode.selectablePredicate = (item) => item.tag === 'I am selectable'
mode.selectablePredicate = (item: IModelItem): boolean =>
item.tag === 'I am selectable'
Gets or sets the TapInputMode which detects single and multiple taps on a CanvasComponent.
Remarks
If no value has been set explicitly, the factory method createTapInputMode will be called upon first access. Upon change the onTapInputModeChanged method will be called.
By default this input mode has a priority of 20
.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
Gets or sets the WaitInputMode that is provided by this instance for those who need to make use of it.
Remarks
If no value has been set explicitly, the factory method createWaitInputMode will be called upon first access. Upon change the onWaitInputModeChanged method will be called.
By default this input mode has a priority of -1
.
Throws
- Exception({ name: 'NotSupportedError' })
- If an attempt is made to change the instance while this mode is
. To exchange a mode, first , then to ensure that all data is initialized correctly.
Examples
See Also
Methods
Adds the given mode
.
Remarks
The input modes will be ordered according to their priority: Input modes with lower priority will be installed earlier.
Input modes will run exclusively if the exclusive property of their installed controller is set to true
. Otherwise they can not and will not be deactivated if another IInputMode acquires the mutex.
Parameters
A map of options to pass to the method.
- mode - IInputMode
- The input mode to add to this mode.
Throws
- Exception({ name: 'ArgumentError' })
- If the same
mode
has is already added to this instance.
Examples
const multiplexingInputMode = new MultiplexingInputMode()
const waitInputMode = new WaitInputMode()
waitInputMode.priority = 0
multiplexingInputMode.add(waitInputMode)
const moveInputMode = new MoveViewportInputMode()
moveInputMode.priority = 5
multiplexingInputMode.add(moveInputMode)
graphComponent.inputMode = multiplexingInputMode
const mode = new GraphEditorInputMode()
const customInputMode = new CustomInputMode()
customInputMode.priority = 10
mode.add(customInputMode)
Defined in
Adjusts the cursor of the CanvasComponent according to the current input mutex owner or the first mode in the list whose ConcurrencyController returns a non-null preferredCursor.
Remarks
Defined in
Cancels all modes.
Implements
Called by the child context's lookup method.
Parameters
A map of options to pass to the method.
Returns
- ↪any
- The result of the lookup query, or
null
.
See Also
Overrides
Clears the selection on the current graphSelection.
Remarks
Actually performs the click on the given item.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item that has been clicked.
- evt - ClickEventArgs
- The original event arguments for the click. Setting its handled property to
true
will indicate that the click was handled. By default this happens when the clicked item is either selected or focused.
Clears the selection on click if the click is not recognized by multiSelectionRecognizer.
Remarks
This method is only called if no item has been hit and at least one item is currently selected.
This will use the clearSelection method to deselect all items.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context where the click appeared
Returns
- ↪boolean
- Whether the selection has been cleared by this method.
Yields an IInputModeContext for the child modes of this mode.
Remarks
Returns
- ↪IInputModeContext
- A new instance that delegates to the parent's context.
Defined in
Factory method for the clickInputMode property.
Remarks
This method will be called upon first access to the clickInputMode property.
Returns
- ↪ClickInputMode
- a new instance of ClickInputMode
Factory method for the contextMenuInputMode property.
Remarks
Returns
- ↪ContextMenuInputMode
- a new instance of ContextMenuInputMode
Helper method that yields a suitably configured InputModeEventArgs for this input mode.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
An input mode context that is available in the InputModeEventArgs.
Can be
null
in which case a new context for this instance is created automatically.
Returns
- ↪InputModeEventArgs
- An input mode event argument that is configured for this instance.
Defined in
Factory method for the itemHoverInputMode property.
Factory method that creates the keyboardInputMode instance.
Factory method for the lassoSelectionInputMode property.
Remarks
This method will be called upon first access to the lassoSelectionInputMode property.
The created input mode is disabled per default.
Returns
- ↪LassoSelectionInputMode
- a new instance of LassoSelectionInputMode
Factory method for the marqueeSelectionInputMode property.
Remarks
Returns
- ↪MarqueeSelectionInputMode
- a new instance of MarqueeSelectionInputMode
Factory method for the MouseHoverInputMode property.
Remarks
Returns
- ↪MouseHoverInputMode
- a new instance of MouseHoverInputMode
Factory method for the moveViewportInputMode property.
Remarks
Returns
- ↪MoveViewportInputMode
- a new instance of moveViewportInputMode
Helper method that yields a suitably configured SelectionEventArgs<T> using the graphSelection for this input mode.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
An input mode context that is available in the SelectionEventArgs<T>.
Can be
null
in which case a new context for this instance is created automatically.
Returns
- ↪SelectionEventArgs<IModelItem>
- A selection event argument that is configured for this instance.
Factory method for the tapInputMode property.
Remarks
Returns
- ↪TapInputMode
- a new instance of TapInputMode
Factory method for the waitInputMode property.
Remarks
Returns
- ↪WaitInputMode
- a new instance of waitInputMode
Actually performs a double-click on the given item.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item that has been double-clicked.
- evt - ClickEventArgs
- The original event arguments for the click. Setting its handled property to
true
will indicate that the double-click was handled and events on other items in the same location are no longer raised.
Actually performs a double-tap on the given item.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item that has been double-tapped.
- evt - TapEventArgs
- The original event arguments for the tap. Setting its handled property to
true
will indicate that the double-tap was handled and events on other items in the same location are no longer raised.
findItems
(location: Point, tests: GraphItemTypes[], filter?: function(IModelItem):boolean) : IEnumerable<IModelItem>Used as a callback to find the items hit underneath a certain point.
Remarks
Parameters
A map of options to pass to the method.
- location - Point
- The location to test.
- tests - GraphItemTypes[]
- An array of GraphItemTypes values that encode for which model items the hit test should be performed for prioritizing. Arrays that contain strings describing the name of GraphItemTypes are converted to an array of GraphItemTypes. For example:
['node', 'edge'] ['NODE', 'EDGE']
- filter - function(IModelItem):boolean
- The predicate that can be used to filter the results. May be
null
.Signature Details
function(obj: IModelItem) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - IModelItem
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
Returns
- ↪IEnumerable<IModelItem>
- An enumerable over the items that have been found for the location.
Examples
/**
* @param {!IInputModeContext} context
* @param {!Point} location
*/
function HandleItemAtLocation(context, location) {
const graphEditorInputMode = context.lookup(GraphEditorInputMode.$class)
const graphItem = graphEditorInputMode
.findItems(location, [GraphItemTypes.NODE | GraphItemTypes.EDGE])
.first()
if (graphItem instanceof INode) {
// ... handle node
} else if (graphItem instanceof IEdge) {
// ... handle edge
}
function HandleItemAtLocation(
context: IInputModeContext,
location: Point
): void {
const graphEditorInputMode = context.lookup(
GraphEditorInputMode.$class
) as GraphEditorInputMode
const graphItem = graphEditorInputMode
.findItems(location, [GraphItemTypes.NODE | GraphItemTypes.EDGE])
.first()
if (graphItem instanceof INode) {
// ... handle node
} else if (graphItem instanceof IEdge) {
// ... handle edge
}
findItems
(context: IInputModeContext, location: Point, tests: GraphItemTypes[], filter?: function(IModelItem):boolean) : IEnumerable<IModelItem>Used as a callback to find the items hit underneath a certain point.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to use for to the isHit callback.
- location - Point
- The location to test.
- tests - GraphItemTypes[]
- An array of GraphItemTypes values that encode for which model items the hit test should be performed for prioritizing. Arrays that contain strings describing the name of GraphItemTypes are converted to an array of GraphItemTypes. For example:
['node', 'edge'] ['NODE', 'EDGE']
- filter - function(IModelItem):boolean
- The predicate that can be used to filter the results. May be
null
.Signature Details
function(obj: IModelItem) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - IModelItem
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
Returns
- ↪IEnumerable<IModelItem>
- An enumerable over the items that have been found for the location.
Examples
/**
* @param {!IInputModeContext} context
* @param {!Point} location
*/
function HandleItemAtLocation(context, location) {
const graphEditorInputMode = context.lookup(GraphEditorInputMode.$class)
const graphItem = graphEditorInputMode
.findItems(location, [GraphItemTypes.NODE | GraphItemTypes.EDGE])
.first()
if (graphItem instanceof INode) {
// ... handle node
} else if (graphItem instanceof IEdge) {
// ... handle edge
}
function HandleItemAtLocation(
context: IInputModeContext,
location: Point
): void {
const graphEditorInputMode = context.lookup(
GraphEditorInputMode.$class
) as GraphEditorInputMode
const graphItem = graphEditorInputMode
.findItems(location, [GraphItemTypes.NODE | GraphItemTypes.EDGE])
.first()
if (graphItem instanceof INode) {
// ... handle node
} else if (graphItem instanceof IEdge) {
// ... handle edge
}
Returns a list of all modes managed by this instance in sorted order.
Called by click to query the item
for an IClickListener in its lookup and handle it appropriately.
Remarks
true
.Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context for the click.
- item - IModelItem
- The item that has been clicked.
- location - Point
- The click location.
Returns
- ↪boolean
- Whether the action has been invoked and handling should be stopped.
See Also
Performs one-time initialization of this instance.
Remarks
This method should not be invoked by subclasses. This will be done automatically upon first installation of this mode.
This code will be executed only once per instance. The inputModeContext property will be null
when this code is executed. This method should not be used to install this mode into a specific canvas. Subclasses should always call base.Initialize()
first.
See Also
Defined in
Installs this mode into the given context that is provided by the canvas.
Remarks
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.
When this instance gets uninstalled from the context the same context instance will be passed to it.
Implementations may hold a reference to the context
instance and use it while they are being installed.
Parameters
A map of options to pass to the method.
- 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 ConcurrencyController for this mode.
See Also
Overrides
Invalidates the canvas this mode is currently installed in.
Defined in
Performs lasso-selection with the given path.
Remarks
Parameters
A map of options to pass to the method.
- lassoBorder - GeneralPath
- The lasso selection path.
Performs marquee selection with the given rectangle.
Remarks
Parameters
A map of options to pass to the method.
- marqueeRectangle - Rect
- The selection rectangle.
Raises the CanvasClicked event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ClickEventArgs
- The ClickEventArgs instance that contains the information about the click.
Raises the CanvasTapped event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - TapEventArgs
- The TapEventArgs instance that contains the information about the tap.
Called when the clickInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - ClickInputMode
- the old value, which may be
null
the first time - newMode - ClickInputMode
- the new value
Called after the active property of the installed ConcurrencyController has been set to true
.
Remarks
Overrides
Called after the active property of the installed ConcurrencyController has been set to false
.
Remarks
null
and releases the mutex if the mutex is currently owned by this instance. Also, all concurrent child modes will be disabled.Overrides
Called when the ContextMenuInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - ContextMenuInputMode
- the old value, which may be
null
the first time - newMode - ContextMenuInputMode
- the new value
Raises the ItemClicked event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ItemClickedEventArgs<IModelItem>
- The ItemClickedEventArgs<T> instance that contains the item that has been clicked.
Raises the ItemDoubleClicked event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ItemClickedEventArgs<IModelItem>
- The ItemClickedEventArgs<T> instance that contains the item that has been double clicked.
Raises the ItemDoubleTapped event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ItemTappedEventArgs<IModelItem>
- The ItemTappedEventArgs<T> instance that contains the item that has been double tapped.
Called when the itemHoverInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - ItemHoverInputMode
- the old value, which may be
null
the first time - newMode - ItemHoverInputMode
- the new value
Raises the ItemLeftClicked event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ItemClickedEventArgs<IModelItem>
- The ItemClickedEventArgs<T> instance that contains the item that has been clicked.
Raises the ItemLeftDoubleClicked event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ItemClickedEventArgs<IModelItem>
- The ItemClickedEventArgs<T> instance that contains the item that has been double clicked.
Raises the ItemRightClicked event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ItemClickedEventArgs<IModelItem>
- The ItemClickedEventArgs<T> instance that contains the item that has been clicked.
Raises the ItemRightDoubleClicked event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ItemClickedEventArgs<IModelItem>
- The ItemClickedEventArgs<T> instance that contains the item that has been double clicked.
Raises the ItemTapped event.
Remarks
true
.Parameters
A map of options to pass to the method.
- evt - ItemTappedEventArgs<IModelItem>
- The ItemTappedEventArgs<T> instance that contains the item that has been tapped.
Called when the keyboardInputMode changed.
Parameters
A map of options to pass to the method.
- oldMode - KeyboardInputMode
- The old keyboardInputMode.
- newMode - KeyboardInputMode
- The new keyboardInputMode.
Performs lasso-selection with the given path.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context.
- lassoBorder - GeneralPath
- The lasso selection path.
onLassoSelectionInputModeChanged
(oldMode: LassoSelectionInputMode, newMode: LassoSelectionInputMode)Called when the lassoSelectionInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - LassoSelectionInputMode
- the old value, which may be
null
the first time - newMode - LassoSelectionInputMode
- the new value
onLassoSelectItems
(context: IInputModeContext, lassoBorder: GeneralPath, items: IEnumerable<IModelItem>, predicate: function(IModelItem):boolean)Selects the given elements in the editor inside the provided lasso-selection path.
Remarks
This implementation iterates over the items and queries them for an implementation of ILassoTestable using their lookup. This instance will be used to determine whether the item should be selected.
This method is, in the default implementation, only called with individual item types in items
.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context.
- lassoBorder - GeneralPath
- The lasso path in world coordinates.
- items - IEnumerable<IModelItem>
- The items to iterate over.
- predicate - function(IModelItem):boolean
- The predicate that determines whether the provided item should be tested at all. May be
null
.Signature Details
function(obj: IModelItem) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - IModelItem
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
See Also
Performs marquee selection with the given rectangle.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context.
- marqueeRectangle - Rect
- The selection rectangle.
onMarqueeSelectionInputModeChanged
(oldMode: MarqueeSelectionInputMode, newMode: MarqueeSelectionInputMode)Called when the marqueeSelectionInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - MarqueeSelectionInputMode
- the old value, which may be
null
the first time - newMode - MarqueeSelectionInputMode
- the new value
onMarqueeSelectItems
(context: IInputModeContext, marqueeRectangle: Rect, items: IEnumerable<IModelItem>, predicate?: function(IModelItem):boolean)Selects the given elements in the editor inside the provided marquee-selection rectangle.
Remarks
This implementation iterates over the items and queries them for an implementation of IMarqueeTestable using their lookup. This instance will be used to determine whether the item should be selected.
This method is, in the default implementation, only called with individual item types in items
.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context.
- marqueeRectangle - Rect
- The rectangle in world coordinates.
- items - IEnumerable<IModelItem>
- The items to iterate over.
- predicate - function(IModelItem):boolean
- The predicate that determines whether the provided item should be tested at all. May be
null
.Signature Details
function(obj: IModelItem) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - IModelItem
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
See Also
Called when the MouseHoverInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - MouseHoverInputMode
- the old value, which may be
null
the first time - newMode - MouseHoverInputMode
- the new value
Called when the moveViewportInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - MoveViewportInputMode
- the old value, which may be
null
the first time - newMode - MoveViewportInputMode
- the new value
Raises the MultiSelectionFinished event.
Raises the MultiSelectionStarted event.
Raises the PopulateItemContextMenu event.
Parameters
A map of options to pass to the method.
- evt - PopulateItemContextMenuEventArgs<IModelItem>
- The PopulateItemContextMenuEventArgs<TModelItem> instance containing the event data.
Raises the QueryItemToolTip event.
Parameters
A map of options to pass to the method.
- evt - QueryItemToolTipEventArgs<IModelItem>
- The QueryItemToolTipEventArgs<TModelItem> instance containing the event data.
Called when the tapInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - TapInputMode
- the old value, which may be
null
the first time - newMode - TapInputMode
- the new value
Called when the waitInputMode property value changes and after initialization of the property.
Parameters
A map of options to pass to the method.
- oldMode - WaitInputMode
- the old value, which may be
null
the first time - newMode - WaitInputMode
- the new value
Removes the given mode from this compound mode.
Parameters
A map of options to pass to the method.
- mode - IInputMode
- The mode to remove.
Defined in
Clears the current selection and selects all nodes and bends in this graph.
Remarks
See Also
Called by this instance to set the current item on the NavigationInputMode
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to set as the new "current" item.
Uses the graphSelection to select the given item.
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to set the selection state on.
- selected - boolean
- The new selection state.
Called to determine whether the given item
can be clicked.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
- Whether the item should be clicked in response to a detected mouse click.
Called to determine whether the given item
should be selected when clicked with the primary mouse button.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
- Whether the item should be selected in response to a detected mouse click with the primary button.
Called to determine whether the given item
can be double clicked.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
- Whether the item should be double clicked in response to a detected mouse click.
Determines whether the provided IModelItem should be set to the current item.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
- Whether to set the item as the current item.
CUsed to determine which of the built-in ICommands to install.
Remarks
true
, subclasses may override this method to adjust the behavior.Parameters
A map of options to pass to the method.
- command - ICommand
- The command to install.
Returns
- ↪boolean
- Whether to install this command.
Used by marqueeSelect and lassoSelect that takes marqueeSelectableItems and shouldSelectItem into account.
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
- Whether to possibly marquee or lasso select the item.
Determines whether for the given item a context menu should be queried.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
- Whether to raise a PopulateItemContextMenu event for the given item.
See Also
Determines whether for the given item a tool tip should be queried.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
- Whether to raise a QueryItemToolTip event for the given item.
Called as a broad classification whether an item can generally be selected.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
true
if the item is selectable in general,false
if not.
Called when the priority of an installed sub mode has changed.
Remarks
Defined in
Actually performs the tap on the given item.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item that has been tapped.
- evt - TapEventArgs
- The original event arguments for the tap. Setting its handled property to
true
will indicate that the tap was handled. By default this happens when the tapped item is either selected or focused.
Tries to stop all modes.
Returns
- ↪boolean
true
if and only if the editing has been stopped or there was no edit in progress
See Also
Implements
Uninstalls this mode from the given context.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to deregister from. This is the same instance that had been passed to install during installation.
Overrides
Events
Occurs when the empty canvas area has been clicked or tapped.
Remarks
If one of the event handlers sets the handled property to true
the event will not be propagated anymore.
This event will also be raised for taps. In this case the CanvasTapped event will be raised before this event. If it is marked handled this event will not be raised anymore.
See Also
Event Registration
addCanvasClickedListener(function(this, ClickEventArgs):void)
Event Deregistration
removeCanvasClickedListener(function(this, ClickEventArgs):void)
Signature Details
function(sender: this, evt: ClickEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - ClickEventArgs
- An object that contains the event data.
Occurs when the empty canvas area has been tapped.
Remarks
true
the event will not be propagated anymore. This also means that the CanvasClicked event will not be raised in that case.See Also
Event Registration
addCanvasTappedListener(function(this, TapEventArgs):void)
Event Deregistration
removeCanvasTappedListener(function(this, TapEventArgs):void)
Signature Details
function(sender: this, evt: TapEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - TapEventArgs
- An object that contains the event data.
Occurs when an item has been clicked or tapped.
Remarks
If one of the event handlers sets the handled property to true
the event will not be propagated anymore.
This event will also be raised for taps.
Button-specific and input type specific events (ItemLeftClicked, ItemRightClicked and ItemTapped) will be raised before this event. If one of those is marked handled this event will not be raised anymore.
Examples
mode.addItemClickedListener((sender, args) => {
const node = args.item
if (node !== null) {
doSomethingWithNode(node)
args.handled = true
}
})
See Also
Event Registration
addItemClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Event Deregistration
removeItemClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: ItemClickedEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - ItemClickedEventArgs<IModelItem>
- An object that contains the event data.
Occurs when an item has been double clicked.
Remarks
If one of the event handlers sets the handled property to true
the event will not be propagated anymore.
Depending on the value of the doubleClickPolicy property of clickInputMode this event may be preceded by no, one, or two ItemClicked events (as well as the corresponding button-specific event).
Button-specific and input-type specific events (ItemLeftDoubleClicked, ItemRightDoubleClicked and ItemDoubleTapped) will be raised before this event. If one of those is marked handled this event will not be raised anymore.
Examples
mode.addItemDoubleClickedListener((sender, args) => {
const node = args.item
if (node !== null) {
doSomethingWithNode(node)
args.handled = true
}
})
See Also
Event Registration
addItemDoubleClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Event Deregistration
removeItemDoubleClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: ItemClickedEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - ItemClickedEventArgs<IModelItem>
- An object that contains the event data.
Occurs when an item has been double tapped.
Remarks
true
the event will not be propagated anymore. This also means that the ItemDoubleClicked event will not be raised in that case.Examples
mode.addItemDoubleTappedListener((sender, args) => {
const node = args.item
if (node !== null) {
doSomethingWithNode(node)
args.handled = true
}
})
See Also
Event Registration
addItemDoubleTappedListener(function(this, ItemTappedEventArgs<IModelItem>):void)
Event Deregistration
removeItemDoubleTappedListener(function(this, ItemTappedEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: ItemTappedEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - ItemTappedEventArgs<IModelItem>
- An object that contains the event data.
Occurs when an item has been left clicked.
Remarks
true
the event will not be propagated anymore. This also means that the ItemClicked event will not be raised in that case.Examples
mode.addItemLeftClickedListener((sender, args) => {
const node = args.item
if (node !== null) {
doSomethingWithNode(node)
args.handled = true
}
})
See Also
Event Registration
addItemLeftClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Event Deregistration
removeItemLeftClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: ItemClickedEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - ItemClickedEventArgs<IModelItem>
- An object that contains the event data.
Occurs when an item has been left double clicked.
Remarks
true
the event will not be propagated anymore. This also means that the ItemDoubleClicked event will not be raised in that case.Examples
mode.addItemLeftDoubleClickedListener((sender, args) => {
const node = args.item
if (node !== null) {
doSomethingWithNode(node)
args.handled = true
}
})
See Also
Event Registration
addItemLeftDoubleClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Event Deregistration
removeItemLeftDoubleClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: ItemClickedEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - ItemClickedEventArgs<IModelItem>
- An object that contains the event data.
Occurs when an item has been right clicked.
Remarks
true
the event will not be propagated anymore. This also means that the ItemClicked event will not be raised in that case.Examples
mode.addItemRightClickedListener((sender, args) => {
const node = args.item
if (node !== null) {
doSomethingWithNode(node)
args.handled = true
}
})
See Also
Event Registration
addItemRightClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Event Deregistration
removeItemRightClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: ItemClickedEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - ItemClickedEventArgs<IModelItem>
- An object that contains the event data.
Occurs when an item has been right double clicked.
Remarks
true
the event will not be propagated anymore. This also means that the ItemDoubleClicked event will not be raised in that case.Examples
mode.addItemRightDoubleClickedListener((sender, args) => {
const node = args.item
if (node !== null) {
doSomethingWithNode(node)
args.handled = true
}
})
See Also
Event Registration
addItemRightDoubleClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Event Deregistration
removeItemRightDoubleClickedListener(function(this, ItemClickedEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: ItemClickedEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - ItemClickedEventArgs<IModelItem>
- An object that contains the event data.
Occurs when an item has been tapped.
Remarks
true
the event will not be propagated anymore. This also means that the ItemClicked event will not be raised in that case.Examples
mode.addItemTappedListener((sender, args) => {
const node = args.item
if (node !== null) {
doSomethingWithNode(node)
args.handled = true
}
})
See Also
Event Registration
addItemTappedListener(function(this, ItemTappedEventArgs<IModelItem>):void)
Event Deregistration
removeItemTappedListener(function(this, ItemTappedEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: ItemTappedEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - ItemTappedEventArgs<IModelItem>
- An object that contains the event data.
Occurs when a single or multi select operation has been finished.
Remarks
Event Registration
addMultiSelectionFinishedListener(function(this, SelectionEventArgs<IModelItem>):void)
Event Deregistration
removeMultiSelectionFinishedListener(function(this, SelectionEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: SelectionEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - SelectionEventArgs<IModelItem>
- An object that contains the event data.
Occurs when a single or multi select operation has been started.
Remarks
Event Registration
addMultiSelectionStartedListener(function(this, SelectionEventArgs<IModelItem>):void)
Event Deregistration
removeMultiSelectionStartedListener(function(this, SelectionEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: SelectionEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - SelectionEventArgs<IModelItem>
- An object that contains the event data.
Occurs when the context menu over an item is about to be opened to determine the contents of the context menu.
Remarks
Examples
// mode is either an instance of GraphEditorInputMode or GraphViewerInputMode
mode.contextMenuItems = GraphItemTypes.NODE
mode.addPopulateItemContextMenuListener((sender, args) => {
// Get the node which is handled or null if the item is not a node
const node = args.item
// Create the context menu items
if (node !== null) {
// Create a menu item to delete the node
// Show the menu
args.showMenu = true
// Mark the event as handled
args.handled = true
}
})
Event Registration
addPopulateItemContextMenuListener(function(this, PopulateItemContextMenuEventArgs<IModelItem>):void)
Event Deregistration
removePopulateItemContextMenuListener(function(this, PopulateItemContextMenuEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: PopulateItemContextMenuEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - PopulateItemContextMenuEventArgs<IModelItem>
- An object that contains the event data.
Occurs when the mouse is hovering over an item to determine the tool tip to display.
Remarks
Examples
Event Registration
addQueryItemToolTipListener(function(this, QueryItemToolTipEventArgs<IModelItem>):void)
Event Deregistration
removeQueryItemToolTipListener(function(this, QueryItemToolTipEventArgs<IModelItem>):void)
Signature Details
function(sender: this, evt: QueryItemToolTipEventArgs<IModelItem>)
Parameters
- sender - this
- The source of the event.
- evt - QueryItemToolTipEventArgs<IModelItem>
- An object that contains the event data.