Event handler for resizing cells. This handler is automatically created in mxGraph.createHandler.
mxVertexHandler | Event handler for resizing cells. |
Functions | |
mxVertexHandler | Constructs an event handler that allows to resize vertices and groups. |
Variables | |
graph | Reference to the enclosing mxGraph. |
state | Reference to the mxCellState being modified. |
singleSizer | Specifies if only one sizer handle at the bottom, right corner should be used. |
index | Holds the index of the current handle. |
allowHandleBoundsCheck | Specifies if the bounds of handles should be used for hit-detection in IE Default is true. |
crisp | Specifies if the selection bounds and handles should be rendered in crisp mode. |
handleImage | Optional mxImage to be used as handles. |
tolerance | Optional tolerance for hit-detection in getHandleForEvent. |
Functions | |
init | Initializes the shapes required for this vertex handler. |
getSelectionBounds | Returns the mxRectangle that defines the bounds of the selection border. |
createSelectionShape | Creates the shape used to draw the selection border. |
getSelectionColor | Returns mxConstants.VERTEX_SELECTION_COLOR. |
getSelectionStrokeWidth | Returns mxConstants.VERTEX_SELECTION_STROKEWIDTH. |
isSelectionDashed | Returns <mxConstants.VERTEX_SELECTION_DASHED>. |
createSizer | Creates a sizer handle for the specified cursor and index and returns the new mxRectangleShape that represents the handle. |
isSizerVisible | Returns true if the sizer for the given index is visible. |
createSizerShape | Creates the shape used for the sizer handle for the specified bounds and index. |
createBounds | Helper method to create an mxRectangle around the given centerpoint with a width and height of 2*s or 6, if no s is given. |
getHandleForEvent | Returns the index of the handle for the given event. |
mouseDown | Handles the event if a handle has been clicked. |
start | Starts the handling of the mouse gesture. |
mouseMove | Handles the event by updating the preview. |
mouseUp | Handles the event by applying the changes to the geometry. |
reset | Resets the state of this handler. |
resizeCell | Uses the given vector to change the bounds of the given cell in the graph using mxGraph.resizeCell. |
union | Returns the union of the given bounds and location for the specified handle index. |
redraw | Redraws the handles and the preview. |
drawPreview | Redraws the preview. |
destroy | Destroys the handler and all its resources and DOM nodes. |
function mxVertexHandler( state )
Constructs an event handler that allows to resize vertices and groups.
state | mxCellState of the cell to be resized. |
mxVertexHandler.prototype.graph
Reference to the enclosing mxGraph.
mxVertexHandler.prototype.state
Reference to the mxCellState being modified.
mxVertexHandler.prototype.handleImage
Optional mxImage to be used as handles. Default is null.
mxVertexHandler.prototype.tolerance
Optional tolerance for hit-detection in getHandleForEvent. Default is 0.
mxVertexHandler.prototype.getSelectionColor = function()
Returns mxConstants.VERTEX_SELECTION_COLOR.
mxVertexHandler.prototype.createSizer = function( cursor, index, size, fillColor )
Creates a sizer handle for the specified cursor and index and returns the new mxRectangleShape that represents the handle.
Helper method to create an mxRectangle around the given centerpoint with a width and height of 2*s or 6, if no s is given.
mxVertexHandler.prototype.resizeCell = function( cell, dx, dy, index, gridEnabled )
Uses the given vector to change the bounds of the given cell in the graph using mxGraph.resizeCell.
mxVertexHandler.prototype.union = function( bounds, dx, dy, index, gridEnabled, scale, tr )
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.
var vertexHandlerUnion = mxVertexHandler.prototype.union; mxVertexHandler.prototype.union = function(bounds, dx, dy, index, gridEnabled, scale, tr) { var 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; };
graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30, 'minWidth=100;minHeight=100;');
Constructs an event handler that allows to resize vertices and groups.
function mxVertexHandler( state )
Reference to the enclosing mxGraph.
mxVertexHandler.prototype.graph
Reference to the mxCellState being modified.
mxVertexHandler.prototype.state
Specifies if only one sizer handle at the bottom, right corner should be used.
mxVertexHandler.prototype.singleSizer
Holds the index of the current handle.
mxVertexHandler.prototype.index
Specifies if the bounds of handles should be used for hit-detection in IE Default is true.
mxVertexHandler.prototype.allowHandleBoundsCheck
Specifies if the selection bounds and handles should be rendered in crisp mode.
mxVertexHandler.prototype.crisp
Optional mxImage to be used as handles.
mxVertexHandler.prototype.handleImage
Optional tolerance for hit-detection in getHandleForEvent.
mxVertexHandler.prototype.tolerance
Returns the index of the handle for the given event.
mxVertexHandler.prototype.getHandleForEvent = function( me )
Initializes the shapes required for this vertex handler.
mxVertexHandler.prototype.init = function()
Returns the mxRectangle that defines the bounds of the selection border.
mxVertexHandler.prototype.getSelectionBounds = function( state )
Creates the shape used to draw the selection border.
mxVertexHandler.prototype.createSelectionShape = function( bounds )
Returns mxConstants.VERTEX_SELECTION_COLOR.
mxVertexHandler.prototype.getSelectionColor = function()
Returns mxConstants.VERTEX_SELECTION_STROKEWIDTH.
mxVertexHandler.prototype.getSelectionStrokeWidth = function()
Returns mxConstants.VERTEX_SELECTION_DASHED.
mxVertexHandler.prototype.isSelectionDashed = function()
Creates a sizer handle for the specified cursor and index and returns the new mxRectangleShape that represents the handle.
mxVertexHandler.prototype.createSizer = function( cursor, index, size, fillColor )
Returns true if the sizer for the given index is visible.
mxVertexHandler.prototype.isSizerVisible = function( index )
Creates the shape used for the sizer handle for the specified bounds and index.
mxVertexHandler.prototype.createSizerShape = function( bounds, index, fillColor )
Handles the event if a handle has been clicked.
mxVertexHandler.prototype.mouseDown = function( sender, me )
Starts the handling of the mouse gesture.
mxVertexHandler.prototype.start = function( x, y, index )
Handles the event by updating the preview.
mxVertexHandler.prototype.mouseMove = function( sender, me )
Handles the event by applying the changes to the geometry.
mxVertexHandler.prototype.mouseUp = function( sender, me )
Resets the state of this handler.
mxVertexHandler.prototype.reset = function()
Uses the given vector to change the bounds of the given cell in the graph using mxGraph.resizeCell.
mxVertexHandler.prototype.resizeCell = function( cell, dx, dy, index, gridEnabled )
Sets the bounds of the given cell using resizeCells.
mxGraph.prototype.resizeCell = function( cell, bounds )
Returns the union of the given bounds and location for the specified handle index.
mxVertexHandler.prototype.union = function( bounds, dx, dy, index, gridEnabled, scale, tr )
Redraws the handles and the preview.
mxVertexHandler.prototype.redraw = function()
Redraws the preview.
mxVertexHandler.prototype.drawPreview = function()
Destroys the handler and all its resources and DOM nodes.
mxVertexHandler.prototype.destroy = function()
Creates a new handler for the given cell state.
mxGraph.prototype.createHandler = function( state )