C

NodeReshapeHandleProvider

Default implementation of the IReshapeHandleProvider interface for nodes.

Remarks

The actual reshaping is delegated to an IReshapeHandler.

Examples

Decorate lookup to customize node resizing
// decorate reshape handle provider
const nodeDecorator = graphComponent.graph.decorator.nodes
nodeDecorator.reshapeHandleProvider.addFactory((node) => {
  // lookup the reshape handler that performs the actual resizing
  const reshapeHandler = node.lookup(IReshapeHandler) as IReshapeHandler
  // create a provider for handles at the node corners
  const handleProvider = new NodeReshapeHandleProvider(
    node,
    reshapeHandler,
    HandlePositions.CORNERS,
  )
  // use a different reshape policy
  handleProvider.reshapePolicy = ReshapePolicy.MAXIMUM
  return handleProvider
})

Members

Show:

Constructors

Creates a default instance that provides handles for each of the handlePositions given for the node.

Parameters

node: INode
The node to provide reshape handles for.
reshapeHandler: IReshapeHandler
The reshape handler to delegate the actual reshaping to.
handlePositions: HandlePositions
conversion
A bitwise combination of all handle positions this instance should provide a handle for.

Properties

Gets or sets the event recognizer that determines if the center of the reshapeable is kept during the reshape gesture.
The default detects the current platform and delegates either to EventRecognizers.META_IS_DOWN (macOS) or EventRecognizers.CTRL_IS_DOWN (other platforms).
final

Examples

Always keeping the node center
// always keep the center of the node
provider.centerReshapeRecognizer = EventRecognizers.ALWAYS

See Also

API
ratioReshapeRecognizer
Gets or sets the bitwise combination of all handle positions this instance provides a handle for.
Gets or sets the maximal bounds this reshapeable may fill.
The value is stored by reference. The default is Rect.INFINITE, which does not restrict the area at all.
conversionfinal
Gets or sets the maximum size allowed for the reshapeable.
The default value is Size.INFINITE.
conversion

Property Value

The maximum size.

See Also

API
maximumSize
Gets or sets the minimum rectangular area that needs to be contained in the reshapeable.
The default value is Rect.EMPTY.
conversion

Property Value

The minimum size.

See Also

API
minimumEnclosedArea
Gets or sets the minimum size allowed for the reshapeable.
The default value is Size.ZERO.
conversion

Property Value

The minimum size.

See Also

API
minimumSize
Gets the node to provide reshape handles for.
readonlyfinal
Gets or sets the event recognizer that determines if the width/height ratio of the reshapeable is kept during the reshape gesture.

This value is set as ReshapeHandlerHandle.ratioReshapeRecognizer of the handle provided in getHandle.

The default value is null.

final

Examples

Always keeping the node ratio
// always keep the aspect ratio
provider.ratioReshapeRecognizer = EventRecognizers.ALWAYS

See Also

API
centerReshapeRecognizer, reshapePolicy
Gets the reshape handler to delegate the actual reshaping to.
readonlyfinal
Gets or sets the policy that determines how the mouse location is interpreted when the reshape gesture shall keep the aspect ratio.
conversionfinal

Examples

Extend the node bounds to the mouse location
// when keeping the aspect ratio extend the node bounds to the mouse location
provider.reshapePolicy = ReshapePolicy.MAXIMUM
Gets or sets an INodeSizeConstraintProvider that is passed to the queried handles.
final

Methods

Returns the handlePositions property.

Parameters

context: IInputModeContext
The context for which the handles are queried.

Return Value

HandlePositions
A bitwise combination of all handle positions this instance provides a handle for if queried in RectangleReshapeHandleProvider.getHandle.
Provides a NodeReshapeHandlerHandle that uses the reshapeHandler to perform the actual reshaping.

Parameters

inputModeContext: IInputModeContext
The context for which the handles are queried.
position: HandlePositions
The position to provide an instance for.

Return Value

IHandle
A handle implementation.