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.
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.
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 VertexHandlerConfig.selectionColor.
Returns true
if the center of the vertex should be maintained during the resize.
Returns true if the given custom handle is visible.
Called if livePreview is enabled to check if a border should be painted.
This implementation returns true
if the shape is transparent.
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 VertexHandlerConfig.selectionDashed.
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.
Redraws 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';
}
};
Uses the given vector to change the bounds of the given cell in the graph using Graph#resizeCell.
Shortcut to hideSizers.
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;
};
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.