Default implementation of the IReshapeHandleProvider interface for nodes.
Remarks
Examples
// 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
})
Type Details
- yFiles module
- view
Constructors
NodeReshapeHandleProvider
(node: INode, reshapeHandler: IReshapeHandler, handlePositions: HandlePositions)Creates a default instance that provides handles for each of the handlePositions
given for the node
.
Parameters
A map of options to pass to the method.
- node - INode
- The node to provide reshape handles for.
- reshapeHandler - IReshapeHandler
- The reshape handler to delegate the actual reshaping to.
- handlePositions - HandlePositions
- 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.
Remarks
Signature Details
function(evt: EventArgs, eventSource: unknown) : boolean
Parameters
- evt - EventArgs
- The arguments of the event to be decided to handle.
- eventSource - unknown
- The source of the event.
Returns
- boolean
true
if theevt
is considered to be handled.
Examples
// always keep the center of the node
provider.centerReshapeRecognizer = EventRecognizers.ALWAYS
See Also
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.
Remarks
Defined in
Gets or sets the maximum size allowed for the reshapeable.
Gets or sets the minimum rectangular area that needs to be contained in the reshapeable.
Gets or sets the minimum size allowed for the reshapeable.
Gets the node to provide reshape handles for.
Gets or sets the event recognizer that determines if the width/height ratio of the reshapeable is kept during the reshape gesture.
Remarks
This value is set as ratioReshapeRecognizer of the handle provided in getHandle.
The default value is null
.
Signature Details
function(evt: EventArgs, eventSource: unknown) : boolean
Parameters
- evt - EventArgs
- The arguments of the event to be decided to handle.
- eventSource - unknown
- The source of the event.
Returns
- boolean
true
if theevt
is considered to be handled.
Examples
// always keep the aspect ratio
provider.ratioReshapeRecognizer = EventRecognizers.ALWAYS
See Also
Gets the reshape handler to delegate the actual reshaping to.
Gets or sets the policy that determines how the mouse location is interpreted when the reshape gesture shall keep the aspect ratio.
Remarks
The ratioReshapeRecognizer is used to determine whether the aspect ratio shall be kept at all. If ratioReshapeRecognizer is not set, the NodeReshapeHandlerHandle provided in getHandle uses the directionalConstraintRecognizer of the HandleInputMode managing this handle.
getHandle propagates this policy value to the reshapePolicy of its TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT and BOTTOM_RIGHT handles. For LEFT and RIGHT handles, HORIZONTAL is used. For TOP and BOTTOM handles, VERTICAL is used.
The default value is PROJECTION.
Examples
// 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.
Methods
Returns the handlePositions property.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context for which the handles are queried.
Returns
- ↪HandlePositions
- A bitwise combination of all handle positions this instance provides a handle for if queried in getHandle.
Implements
Provides a NodeReshapeHandlerHandle that uses the reshapeHandler to perform the actual reshaping.
Remarks
The minimumSize, maximumSize, minimumEnclosedArea, maximumBoundingArea, ratioReshapeRecognizer and centerReshapeRecognizer are propagated to the NodeReshapeHandlerHandle.
The reshapePolicy is only propagated if the position
is neither HORIZONTAL nor VERTICAL. If position
is HORIZONTAL, HORIZONTAL is set. If position
is VERTICAL, VERTICAL is set.
This method may be called for each possible single position contained in the set as returned by getAvailableHandles.
Parameters
A map of options to pass to the method.
- inputModeContext - IInputModeContext
- The context for which the handles are queried.
- position - HandlePositions
- The position to provide an instance for.
Returns
- ↪IHandle
- A handle implementation.