C

PortRelocationHandleProvider

An implementation of an IHandleProvider that can be used for IEdges.

Remarks

It will return the IHandles for the source and target ports using PortRelocationHandles.

The properties showHitPortOwnerCandidatesOnly, maximumSnapDistance and visualization will only be used in createPortRelocationHandle to configure the created PortRelocationHandles.

Note that this implementation also explicitly implements the IEdgePortHandleProvider and that it is recommended to decorate the IEdgePortHandleProvider interface with edges in order to influence the handles of the source and target port of the edge instead of directly decorating and implementing the IHandleProvider interface. The default implementation of the IHandleProvider interface in the lookup of the IEdges (see DEFAULT_EDGE_LOOKUP) will use the IEdgeReconnectionPortCandidateProvider interface to collect the source and target port handles.

Examples

This implementation provides instances of PortRelocationHandle. The most commonly used settings for PortRelocationHandle are available here, 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

Members

Show:

Constructors

Initializes a new instance of the PortRelocationHandleProvider class using the given graph and edge.

Parameters

graph: IGraph
The graph or null. If the graph is null, the handles will try to receive the graph from the IInputModeContext it is used in.
edge: IEdge
The edge.

Properties

Gets or sets the maximum distance the pointer may be away from a candidate in order to be snapped to the candidate.
The distance is measured in view coordinates. The default value is 50.0.
final

See Also

API
maximumSnapDistance
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.

This class will assign the value of this property to portCandidateRenderer in createPortRelocationHandle.

The default value is an instance of PortCandidateRenderer.

final

Property Value

The renderer for the port candidate visualizations.

See Also

API
portCandidateRenderer
Gets or sets a value indicating whether to show the candidates of hit IPortOwners only.
final

Property Value

true if only candidates of hit nodes and edges are shown; false otherwise.

See Also

API
showHitPortOwnerCandidatesOnly
Gets or sets a value indicating whether to show port candidates.
final

Property Value

true port candidates should be shown; false otherwise. Default is true.

See Also

API
showPortCandidates
Gets or sets whether the owner of the current IPortCandidate should be highlighted.
The default is true.
final

See Also

API
showTargetHighlight
Gets or sets how the changed edge should be shown during the gesture.

If this property is set to LIVE it is crucial that graph is not null and edge is contained in that graph.

Default is PLACEHOLDER.

conversionfinal

See Also

API
visualization

Methods

Factory method that creates the handle for this provider.
protected

Parameters

graph: IGraph
The graph that contains the edge.
edge: IEdge
The edge.
sourcePort: boolean
if set to true the handle for the source port is sought.

Return Value

IHandle
A handle or null.

See Also

Developer's Guide
Gets an IHandle implementation for one end of the edge.
final

Parameters

context: IInputModeContext
The context in which the handle will be used.
sourceHandle: boolean
if set to true the handle for the source side/port should be returned.

Return Value

IHandle
The handle to use for the provided side or null.
Returns a collection of zero or more IHandle implementations that are associated with this instance.

Parameters

context: IInputModeContext
The IInputModeContext that provides the invoking mode.

Return Value

IEnumerable<IHandle>
A collection of handles.

Fields

The edge this provider is working on.
protectedfinal
The graph this provider is working on.
protectedfinal