Constructs an event handler that allows to resize vertices and groups.
Specifies if the bounds of handles should be used for hit-detection in IE or if tolerance > 0.
Specifies if the size of groups should be constrained by the children.
Reference to the enclosing Graph.
Optional Image to be used as handles.
If handles are currently visible.
The horizontal offset for the handles. This is updated in redrawHandles
if manageSizers is true
and the sizers are offset horizontally.
Holds the index of the current handle.
Specifies if resize should change the cell in-place. This is an experimental feature for non-touch devices.
Specifies if sizers should be hidden and spaced if the vertex is small.
Specifies if the live preview should be moved to the front.
Specifies if the parent should be highlighted if a child cell is selected.
Specifies the cursor for the rotation handle.
Vertical spacing for rotation icon.
Specifies if rotation steps should be "rasterized" depending on the distance to the handle.
Specifies if only one sizer handle at the bottom, right corner should be used.
Reference to the CellState being modified.
Optional tolerance for hit-detection in getHandleForEvent.
The horizontal offset for the handles. This is updated in
Checks if the coordinates for the given event are within the Graph#tolerance. If the event is a mouse event then the tolerance is ignored.
Returns an array of custom handles.
This implementation returns an empty array.
Starts the handling of the mouse gesture.
Creates the shape used to draw the selection border.
Creates the shape used to draw the selection border.
Creates a sizer handle for the specified cursor and index and returns the new RectangleShape that represents the handle.
Creates the shape used for the sizer handle for the specified bounds an index. Only images and rectangles should be returned if support for HTML labels with not foreign objects is required.
Redraws the preview.
Returns the index of the handle for the given event. This returns the index of the sizer from where the event originated or InternalEvent.LABEL_HANDLE.
Returns the padding to be used for drawing handles for the current
Returns the bounds for the selection border.
Returns VertexHandlerConfig.selectionColor.
Returns the bounds used to paint the resize handles.
Hides all sizers except.
Starts the handling of the mouse gesture.
Returns true
if the center of the vertex should be maintained during the resize.
Returns true
if the aspect ratio if the cell should be maintained.
Returns true
if the given event allows custom handles to be changed.
This implementation returns true
.
Returns true
if this handler was destroyed or not initialized.
Returns true
if a ghost preview should be used for custom handles.
Called if livePreview is enabled to check if a border should be painted.
This implementation returns true
if the shape is transparent.
Returns true
if the parent highlight should be visible.
This implementation always returns true
.
Returns the recursiveResize
status of the given state.
the given CellState. This implementation takes the value of this state.
the mouse event.
Protected
isSpecifies if a rotation handle should be visible.
This implementation returns VertexHandlerConfig.rotationEnabled.
Returns true
if the rotation handle should be showing.
Returns VertexHandlerConfig.selectionDashed.
Returns true
if the sizer for the given index is visible.
This implementation returns true
for all given indices.
Handles the event if a handle has been clicked. By consuming the event all subsequent events of the gesture are redirected to this handler.
Handles the event by updating the preview.
Handles the event by applying the changes to the geometry.
Moves the children of the given cell by the given vector.
Handles the event by applying the changes to the geometry.
Destroys the handler and all its resources and DOM nodes.
Redraws the handles and the preview.
Optional
ignoreHandles: booleanRedraws the handles. To hide certain handles the following code can be used.
redrawHandles()
{
mxVertexHandlerRedrawHandles.apply(this, arguments);
if (this.sizers != null && this.sizers.length > 7)
{
this.sizers[1].node.style.display = 'none';
this.sizers[6].node.style.display = 'none';
}
};
Hooks for subclasses to hide details when the handler gets inactive.
Resets the state of this handler.
Uses the given vector to change the bounds of the given cell in the graph using Graph#resizeCell.
Hook for subclasses to implement a single click on the rotation handle. This code is executed as part of the model transaction.
This implementation is empty.
Hook for rounding the angle. This uses Math.round.
Hook for rounding the unscaled width or height. This uses Math.round.
Starts the handling of the mouse gesture.
Returns the union of the given bounds and location for the specified handle index.
To override this to limit the size of vertex via a minWidth/-Height style, the following code can be used.
let vertexHandlerUnion = union;
union = (bounds, dx, dy, index, gridEnabled, scale, tr, constrained)=>
{
let result = vertexHandlerUnion.apply(this, arguments);
result.width = Math.max(result.width, mxUtils.getNumber(this.state.style, 'minWidth', 0));
result.height = Math.max(result.height, mxUtils.getNumber(this.state.style, 'minHeight', 0));
return result;
};
The minWidth/-Height style can then be used as follows:
graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30, 'minWidth=100;minHeight=100;');
To override this to update the height for a wrapped text if the width of a vertex is changed, the following can be used.
let mxVertexHandlerUnion = union;
union = (bounds, dx, dy, index, gridEnabled, scale, tr, constrained)=>
{
let result = mxVertexHandlerUnion.apply(this, arguments);
let s = this.state;
if (this.graph.isHtmlLabel(s.cell) && (index == 3 || index == 4) &&
s.text != null && s.style.whiteSpace == 'wrap')
{
let label = this.graph.getLabel(s.cell);
let fontSize = mxUtils.getNumber(s.style, 'fontSize', mxConstants.DEFAULT_FONTSIZE);
let ww = result.width / s.view.scale - s.text.spacingRight - s.text.spacingLeft
result.height = mxUtils.getSizeForString(label, fontSize, s.style.fontFamily, ww).height;
}
return result;
};
Hook for subclasses do show details while the handler is active.
Initializes the shapes required for this vertex handler.
Updates the highlight of the parent if parentHighlightEnabled is true
.
Event handler for resizing cells.
This handler is automatically created in Graph#createHandler.
Some elements of this handler and its subclasses can be configured using EdgeHandlerConfig.