Remarks
In addition to the ReshapeHandlerHandle this implementation supports snapping if the node provides an INodeReshapeSnapResultProvider in its lookup and an active GraphSnapContext is found.
Furthermore orthogonal edges attached to the node are kept orthogonal during the reshape gesture if an active OrthogonalEdgeEditingContext is found.
Examples
class MyNodeReshapeHandleProvider extends NodeReshapeHandleProvider {
constructor(node: INode, reshapeHandler: IReshapeHandler) {
super(node, reshapeHandler, HandlePositions.CORNERS)
}
getHandle(
inputModeContext: IInputModeContext,
position: HandlePositions,
): IHandle {
const handle = new NodeReshapeHandlerHandle(
this.node,
this.reshapeHandler,
position,
)
if (position === HandlePositions.BOTTOM_RIGHT) {
// bottom-right handle should always keep aspect ratio
handle.reshapePolicy = ReshapePolicy.PROJECTION
handle.ratioReshapeRecognizer = EventRecognizers.ALWAYS
}
return handle
}
}Members
Constructors
Default constructor that creates a handle for the given position to reshape the node using the given reshapeHandler.
node using the given reshapeHandler.Parameters
- node: INode
- The node to reshape with this handle.
- reshapeHandler: IReshapeHandler
- The reshapeable to write the changes to.
- position: HandlePositionsconversion
- The position of the handle.
Properties
Gets or sets the event recognizer that determines if the center of the reshapeable is kept during the reshape gesture.
- evt: EventArgs
- The arguments of the event to be decided to handle.
- eventSource: unknown
- The source of the event.
- boolean
trueif theevtis considered to be handled.
Examples
// always keep the center of the node
handle.centerReshapeRecognizer = EventRecognizers.ALWAYSSee Also
Gets or sets the cursor to display when the mouse hovers over or drags this handle.
Defined in
ReshapeHandlerHandle.cursorGets a view of the center of the handle.
Defined in
ReshapeHandlerHandle.locationGets or sets the maximal bounds this reshapeable may fill.
Defined in
ReshapeHandlerHandle.maximumBoundingAreaGets or sets the maximum size allowed for the reshapeable.
Overrides
ReshapeHandlerHandle.maximumSizeGets or sets the minimum enclosed area that needs to be encompassed by this reshapeable.
Gets or sets the minimum size allowed for the reshapeable.
Overrides
ReshapeHandlerHandle.minimumSizeGets the node to reshape with this handle.
Gets the position of the handle.
Defined in
ReshapeHandlerHandle.positionGets or sets the event recognizer that determines if the width/height ratio of the reshapeable is kept during the reshape gesture.
null and if no value is set, handleMove instead tries to find the HandleInputMode that manages this handle and calls its HandleInputMode.isDirectionalConstrained method.- evt: EventArgs
- The arguments of the event to be decided to handle.
- eventSource: unknown
- The source of the event.
- boolean
trueif theevtis considered to be handled.
Examples
// always keep the aspect ratio
handle.ratioReshapeRecognizer = EventRecognizers.ALWAYSSee Also
Gets the IReshapeHandler instance to write the changes to.
Defined in
ReshapeHandlerHandle.reshapeHandlerGets or sets the policy that determines how the mouse location is interpreted when the reshape gesture shall keep the aspect ratio.
The ratioReshapeRecognizer is used to determine whether the aspect ratio shall be kept at all.
The default value is ReshapePolicy.PROJECTION.
Examples
// when keeping the aspect ratio extend the node bounds to the mouse location
handle.reshapePolicy = ReshapePolicy.MAXIMUMDefined in
ReshapeHandlerHandle.reshapePolicyGets or sets an INodeSizeConstraintProvider that is queried in minimumSize, maximumSize and minimumEnclosedArea if no explicit value was set.
Defined in
ReshapeHandlerHandle.tagGets or sets the type of the handle that can be used by the rendering engine to render types differently.
Defined in
ReshapeHandlerHandle.typeMethods
Delegates the cancel request to the IReshapeHandler.
Parameters
- inputModeContext: 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.
Overrides
ReshapeHandlerHandle.cancelDragDelegates the finish request to the IReshapeHandler using the last bounds calculated by handleMove.
Parameters
- inputModeContext: 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.
Overrides
ReshapeHandlerHandle.dragFinishedIgnore clicks.
Parameters
- evt: ClickEventArgs
- Arguments describing the click.
Defined in
ReshapeHandlerHandle.handleClickTranslates the move request into new bounds and delegates applying the new bounds to the IReshapeHandler.handleReshape method.
Parameters
- inputModeContext: 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.
Overrides
ReshapeHandlerHandle.handleMoveCalled by clients to indicate that the element is going to be dragged.
Parameters
- inputModeContext: IInputModeContext
- The context to retrieve information about the drag from.
Overrides
ReshapeHandlerHandle.initializeDragReturns if the reshapeHandler should keep the aspect ratio.
If reshapePolicy is ReshapePolicy.NONE, this method will return false. Otherwise, if ratioReshapeRecognizer is set, it is queried with the CanvasComponent.lastInputEvent.
If ratioReshapeRecognizer is null but the IInputModeContext.inputMode is a HandleInputMode, its HandleInputMode.isDirectionalConstrained method is called.
Parameters
- context: IInputModeContext
- The context to retrieve information about the drag from.
Return Value
- boolean
- Whether the reshapeHandler should keep the aspect ratio.