- I
- I
Remarks
Examples
Instances of this IHandle are provided by the PortRelocationHandleProvider. The most commonly used settings are available on the PortRelocationHandleProvider, too:
graph.decorator.edges.portHandleProvider.addFactory((edge) => {
const portRelocationHandleProvider = new PortRelocationHandleProvider(
graph,
edge,
)
portRelocationHandleProvider.visualization = Visualization.LIVE
portRelocationHandleProvider.showPortCandidates = false
return portRelocationHandleProvider
})For less frequently used settings a custom PortRelocationHandleProvider has to be provided and its createPortRelocationHandle method has to be overridden to provide the configured PortRelocationHandle:
graph.decorator.edges.portHandleProvider.addFactory((edge) => {
const portRelocationHandleProvider = new MyHandleProvider(graph, edge)
portRelocationHandleProvider.visualization = Visualization.LIVE
portRelocationHandleProvider.showPortCandidates = false
return portRelocationHandleProvider
})
class MyHandleProvider extends PortRelocationHandleProvider {
constructor(graph: IGraph, edge: IEdge) {
super(graph, edge)
}
createPortRelocationHandle(
graph: IGraph,
edge: IEdge,
sourceEnd: boolean,
): IHandle {
const portRelocationHandle = new PortRelocationHandle(
graph,
edge,
sourceEnd,
)
portRelocationHandle.addExistingPort = true
return portRelocationHandle
}
}See Also
Developer's Guide
API
- getPortCandidates, reconnectionPortCandidateProvider
Members
Constructors
Creates a new instance of the PortRelocationHandle class.
Parameters
- graph: IGraph
- The graph or
null. If the graph instance is not specified, the handle will try to receive the graph from the IInputModeContext it is passed in during initializeDrag. - edge: IEdge
- The edge.
- sourceEnd: boolean
- if set to
truethe source end will be subject to relocation, otherwise it will be the target port.
Properties
true. If this property is set to false, getPortCandidates will return only the ports provided by the IPortCandidateProvider in the node's lookup.false.true.Gets the cursor to display when the mouse hovers over or drags this handle.
Implements
IHandle.cursorGets the edge this instance acts upon.
Property Value
Gets a view of the location of the item.
this.Implements
IDragHandler.location50.0.See Also
Developer's Guide
API
- maximumSnapDistance
Gets or sets the context to operate on.
Gets or sets the IObjectRenderer<PortCandidateRenderTag> that visualizes the IPortCandidates.
When queried for an IVisualCreator to obtain the visualizations for port candidates, this renderer is passed instances of PortCandidateRenderTag as render tag. The renderer may change the appearance of a port candidate depending on isCurrentCandidate and validity.
The default value is an instance of PortCandidateRenderer.
Property Value
See Also
Note that this property has no effect if resolvePortCandidates is set to false.
The default detects the current platform and delegates either to META_IS_DOWN (macOS) or CTRL_IS_DOWN (other platforms).
Gets the preview edge this instance uses during the edit.
Property Value
See Also
Gets or sets a value indicating whether a DYNAMIC port candidate should be resolved for the current mouse location.
See Also
Gets or sets a value indicating whether to show the candidates of hit IPortOwners only.
Property Value
true if only candidates of hit nodes and edges are shown; false otherwise. Default is true.See Also
Developer's Guide
API
- showHitPortOwnerCandidatesOnly
Property Value
true port candidates should be shown; false otherwise. Default is true.See Also
Developer's Guide
API
- showPortCandidates
Gets or sets whether the owner of the current IPortCandidate should be highlighted.
Property Value
true if the source end is handled; false otherwise.Implements
IHandle.tagGets the type of the handle that can be used by the rendering engine to render types differently.
Implements
IHandle.typeGets or sets how the changed edge should be shown during the gesture.
This property must not be changed during the gesture.
If this property is set to LIVE it is crucial that constructor's graph parameter is not null and its edge parameter is an edge which is contained in that graph.
Default is PLACEHOLDER.
See Also
Developer's Guide
API
- visualization
Methods
Called by clients to indicate that the dragging has been canceled by the user.
Parameters
- context: IInputModeContext
- The context to retrieve information about the drag from.
- originalLocation: Point
- The value of the coordinate of the location property at the time of initializeDrag.
Implements
IDragHandler.cancelDragFactory method that creates the candidate for the existing port.
Parameters
- port: IPort
- The port to create a candidate for.
Return Value
- IPortCandidate
- The candidate or
null.
See Also
Factory method that creates the preview edge that will be shown during the drag operation.
Parameters
- edge: IEdge
- The edge to be represented by the preview edge.
Return Value
- SimpleEdge
- The preview edge instance to use.
See Also
Called by clients to indicate that the repositioning has just been finished.
Parameters
- context: IInputModeContext
- The context to retrieve information about the drag from.
- originalLocation: Point
- The value of the location property at the time of initializeDrag.
- newLocation: Point
- The coordinates in the world coordinate system that the client wants the handle to be at. Depending on the implementation the location may or may not be modified to reflect the new value. This is the same value as delivered in the last invocation of handleMove.
Implements
IDragHandler.dragFinishedFilters the given allCandidates to return the subset of candidates which are relevant at the given location.
allCandidates to return the subset of candidates which are relevant at the given location.If showHitPortOwnerCandidatesOnly is set to true, this implementation returns only the candidates of the port owner at the given location. Otherwise, it returns the entire allCandidates.
Developers can override this method to apply a different filter, e.g., all port candidates in a defined radius around the location.
Parameters
- context: IInputModeContext
- The context that is used to retrieve the candidates for.
- location: Point
- The current location.
- allCandidates: IEnumerable<IPortCandidate>
- All possible port candidates.
Return Value
- IEnumerable<IPortCandidate>
- The filtered list of port candidates.
Finds the closest candidate from the given set of candidates.
Parameters
- context: IInputModeContext
- The context in which the closest handle candidate is sought.
- location: Point
- The location for which to find a candidate.
- candidates: IEnumerable<IPortCandidate>
- The list of possible candidates.
Return Value
- IPortCandidate
- The closest candidate or
null.
Gets the IPortOwner at the given location.
location.Parameters
- context: IInputModeContext
- The input mode context.
- location: Point
- The location to find a port owner at.
Return Value
- IPortOwner
- The IPortOwner at the given location or
null.
Gets the graph to use from the context.
Parameters
- context: IInputModeContext
- The input mode context.
Return Value
- IGraph
- A graph instance or
null.
Called during dragFinished to actually get the new port from the chosen candidate.
Parameters
- context: IInputModeContext
- portCandidate: IPortCandidate
- The candidate to get a port instance from.
- suggestedLocation: Point
- The suggested location for the port.
Return Value
- IPort
- A non-
nullport instance.
See Also
API
- setPorts
Gets the possible candidates for the given edge.
Parameters
- context: IInputModeContext
- The context that is used to retrieve the candidates for.
- edge: IEdge
- The edge.
- sourcePort: boolean
- Whether to look for source port candidates.
Return Value
- IEnumerable<IPortCandidate>
- A non-
nullenumerable over the candidates.
Retrieves the port candidates during handleMove.
Parameters
- context: IInputModeContext
- The context that is used to retrieve the candidates for.
- edge: IEdge
- The edge.
- sourcePort: boolean
- Whether to look for source port candidates.
Return Value
- IEnumerable<IPortCandidate>
- A non-
nullenumerable over the candidates.
Called to indicate that the handle has been clicked or tapped by the user.
This method is called by HandleInputMode when clickRecognizer or clickRecognizerTouch is triggered.
Changing the cursor or type of the clicked handle will instantly be considered by the HandleInputMode but handles won't be re-queried automatically. If, for example, different handles should be used as a result of the click, requeryHandles has to be called.
Parameters
- evt: ClickEventArgs
- Arguments describing the click.
Implements
IHandle.handleClickCalled by clients to indicate that the element has been dragged and its position should be updated.
Parameters
- context: IInputModeContext
- The context to retrieve information about the drag from.
- originalLocation: Point
- The value of the location property at the time of initializeDrag.
- newLocation: Point
- The coordinates in the world coordinate system that the client wants the handle to be at. Depending on the implementation, the location may or may not be modified to reflect the new value.
Implements
IDragHandler.handleMoveHides the original edge that during the drag operation.
Parameters
- context: IInputModeContext
- The context to get the canvas the edge should be hidden from.
- edge: IEdge
- The edge to hide.
See Also
Called by clients to indicate that the element is going to be dragged.
Parameters
- context: IInputModeContext
- The context to retrieve information about the drag from.
Implements
IDragHandler.initializeDragDetermines whether port candidate resolution is enabled for the current gesture.
Parameters
- context: IInputModeContext
- The context to inspect.
Return Value
- boolean
trueif port candidates may be resolved;falseotherwise.
Tries to resolve a dynamic port candidate for the given location.
Parameters
- context: IInputModeContext
- The context in which the candidate is resolved.
- portCandidate: IPortCandidate
- The candidate.
- location: Point
- The current location.
Return Value
- IPortCandidate
- A candidate.
Updates the closest candidate for visual feedback.
Triggered by dragFinished to actually change the port.
Parameters
- context: IInputModeContext
- The context.
- edge: IEdge
- The edge to change ports.
- setSourcePort: boolean
- Whether to set the source port.
falsefor target ports. - portCandidate: IPortCandidate
- The candidate that has been chosen.
- suggestedLocation: Point
- The suggested location for the port.
Finally sets the ports for the edge to the new values.
Parameters
- context: IInputModeContext
- The context in which the ports are set.
- edge: IEdge
- The edge to set the ports for.
- sourcePort: IPort
- The (possibly) new source port.
- targetPort: IPort
- The (possibly) new target port.
Updates the position of the handle.
Updates the preview edge's visual appearance to reflect the new port candidate.
Parameters
- preview: SimpleEdge
- The preview edge.
- source: boolean
- Whether to update the source or target port.
- portCandidate: IPortCandidate
- The new candidate to indicate.
Unhides the original edge that was hidden during the drag operation.
Parameters
- edge: IEdge
- The edge to unhide.
- canvasComponent: CanvasComponent
- The control the edge was hidden from.
See Also
Draws the highlight for the owner of the current port candidate.
This implementation retrieves the HighlightIndicatorManager<T> from the parentInputModeContext's ILookup.
Overriders have to take care of removal of the highlight of the oldCandidate's owner, too.
Parameters
- oldCandidate: IPortCandidate
- The port candidate whose owner is currently highlighted.
- newCandidate: IPortCandidate
- The port candidate whose owner should be highlighted.