mxVertexHandler

Event handler for resizing cells.  This handler is automatically created in mxGraph.createHandler.

Summary
mxVertexHandlerEvent handler for resizing cells.
Functions
mxVertexHandlerConstructs an event handler that allows to resize vertices and groups.
Variables
graphReference to the enclosing mxGraph.
stateReference to the mxCellState being modified.
singleSizerSpecifies if only one sizer handle at the bottom, right corner should be used.
indexHolds the index of the current handle.
allowHandleBoundsCheckSpecifies if the bounds of handles should be used for hit-detection in IE Default is true.
crispSpecifies if the selection bounds and handles should be rendered in crisp mode.
handleImageOptional mxImage to be used as handles.
toleranceOptional tolerance for hit-detection in getHandleForEvent.
Functions
initInitializes the shapes required for this vertex handler.
getSelectionBoundsReturns the mxRectangle that defines the bounds of the selection border.
createSelectionShapeCreates the shape used to draw the selection border.
getSelectionColorReturns mxConstants.VERTEX_SELECTION_COLOR.
getSelectionStrokeWidthReturns mxConstants.VERTEX_SELECTION_STROKEWIDTH.
isSelectionDashedReturns <mxConstants.VERTEX_SELECTION_DASHED>.
createSizerCreates a sizer handle for the specified cursor and index and returns the new mxRectangleShape that represents the handle.
isSizerVisibleReturns true if the sizer for the given index is visible.
createSizerShapeCreates the shape used for the sizer handle for the specified bounds and index.
createBoundsHelper method to create an mxRectangle around the given centerpoint with a width and height of 2*s or 6, if no s is given.
getHandleForEventReturns the index of the handle for the given event.
mouseDownHandles the event if a handle has been clicked.
startStarts the handling of the mouse gesture.
mouseMoveHandles the event by updating the preview.
mouseUpHandles the event by applying the changes to the geometry.
resetResets the state of this handler.
resizeCellUses the given vector to change the bounds of the given cell in the graph using mxGraph.resizeCell.
unionReturns the union of the given bounds and location for the specified handle index.
redrawRedraws the handles and the preview.
drawPreviewRedraws the preview.
destroyDestroys the handler and all its resources and DOM nodes.

Functions

mxVertexHandler

function mxVertexHandler(state)

Constructs an event handler that allows to resize vertices and groups.

Parameters

statemxCellState of the cell to be resized.

Variables

graph

mxVertexHandler.prototype.graph

Reference to the enclosing mxGraph.

state

mxVertexHandler.prototype.state

Reference to the mxCellState being modified.

singleSizer

mxVertexHandler.prototype.singleSizer

Specifies if only one sizer handle at the bottom, right corner should be used.  Default is false.

index

mxVertexHandler.prototype.index

Holds the index of the current handle.

allowHandleBoundsCheck

mxVertexHandler.prototype.allowHandleBoundsCheck

Specifies if the bounds of handles should be used for hit-detection in IE Default is true.

crisp

mxVertexHandler.prototype.crisp

Specifies if the selection bounds and handles should be rendered in crisp mode.  Default is true.

handleImage

mxVertexHandler.prototype.handleImage

Optional mxImage to be used as handles.  Default is null.

tolerance

mxVertexHandler.prototype.tolerance

Optional tolerance for hit-detection in getHandleForEvent.  Default is 0.

Functions

init

mxVertexHandler.prototype.init = function()

Initializes the shapes required for this vertex handler.

getSelectionBounds

mxVertexHandler.prototype.getSelectionBounds = function(state)

Returns the mxRectangle that defines the bounds of the selection border.

createSelectionShape

mxVertexHandler.prototype.createSelectionShape = function(bounds)

Creates the shape used to draw the selection border.

getSelectionColor

mxVertexHandler.prototype.getSelectionColor = function()

Returns mxConstants.VERTEX_SELECTION_COLOR.

getSelectionStrokeWidth

mxVertexHandler.prototype.getSelectionStrokeWidth = function()

Returns mxConstants.VERTEX_SELECTION_STROKEWIDTH.

isSelectionDashed

mxVertexHandler.prototype.isSelectionDashed = function()

Returns <mxConstants.VERTEX_SELECTION_DASHED>.

createSizer

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.

isSizerVisible

mxVertexHandler.prototype.isSizerVisible = function(index)

Returns true if the sizer for the given index is visible.  This returns true for all given indices.

createSizerShape

mxVertexHandler.prototype.createSizerShape = function(bounds,
index,
fillColor)

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

mxVertexHandler.prototype.getHandleForEvent = function(me)

Returns the index of the handle for the given event.  This returns the index of the sizer from where the event originated or <mxEvent.LABEL_INDEX>.

mouseDown

mxVertexHandler.prototype.mouseDown = function(sender,
me)

Handles the event if a handle has been clicked.  By consuming the event all subsequent events of the gesture are redirected to this handler.

start

mxVertexHandler.prototype.start = function(x,
y,
index)

Starts the handling of the mouse gesture.

mouseMove

mxVertexHandler.prototype.mouseMove = function(sender,
me)

Handles the event by updating the preview.

mouseUp

mxVertexHandler.prototype.mouseUp = function(sender,
me)

Handles the event by applying the changes to the geometry.

reset

mxVertexHandler.prototype.reset = function()

Resets the state of this handler.

resizeCell

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.

union

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;
};

The minWidth/-Height style can then be used as follows

graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30, 'minWidth=100;minHeight=100;');

redraw

mxVertexHandler.prototype.redraw = function()

Redraws the handles and the preview.

drawPreview

mxVertexHandler.prototype.drawPreview = function()

Redraws the preview.

destroy

mxVertexHandler.prototype.destroy = function()

Destroys the handler and all its resources and DOM nodes.

function mxVertexHandler(state)
Constructs an event handler that allows to resize vertices and groups.
mxVertexHandler.prototype.graph
Reference to the enclosing mxGraph.
Extends mxEventSource to implement a graph component for the browser.
mxVertexHandler.prototype.state
Reference to the mxCellState being modified.
Represents the current state of a cell in a given mxGraphView.
mxVertexHandler.prototype.singleSizer
Specifies if only one sizer handle at the bottom, right corner should be used.
mxVertexHandler.prototype.index
Holds the index of the current handle.
mxVertexHandler.prototype.allowHandleBoundsCheck
Specifies if the bounds of handles should be used for hit-detection in IE Default is true.
mxVertexHandler.prototype.crisp
Specifies if the selection bounds and handles should be rendered in crisp mode.
mxVertexHandler.prototype.handleImage
Optional mxImage to be used as handles.
Encapsulates the URL, width and height of an image.
mxVertexHandler.prototype.tolerance
Optional tolerance for hit-detection in getHandleForEvent.
mxVertexHandler.prototype.getHandleForEvent = function(me)
Returns the index of the handle for the given event.
mxVertexHandler.prototype.init = function()
Initializes the shapes required for this vertex handler.
mxVertexHandler.prototype.getSelectionBounds = function(state)
Returns the mxRectangle that defines the bounds of the selection border.
mxVertexHandler.prototype.createSelectionShape = function(bounds)
Creates the shape used to draw the selection border.
mxVertexHandler.prototype.getSelectionColor = function()
Returns mxConstants.VERTEX_SELECTION_COLOR.
Defines the color to be used for the selection border of vertices.
mxVertexHandler.prototype.getSelectionStrokeWidth = function()
Returns mxConstants.VERTEX_SELECTION_STROKEWIDTH.
Defines the strokewidth to be used for vertex selections.
mxVertexHandler.prototype.isSelectionDashed = function()
Returns mxConstants.VERTEX_SELECTION_DASHED.
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.
Extends mxShape to implement a rectangle shape.
mxVertexHandler.prototype.isSizerVisible = function(index)
Returns true if the sizer for the given index is visible.
mxVertexHandler.prototype.createSizerShape = function(bounds,
index,
fillColor)
Creates the shape used for the sizer handle for the specified bounds and index.
Extends mxPoint to implement a 2-dimensional rectangle with double precision coordinates.
mxVertexHandler.prototype.mouseDown = function(sender,
me)
Handles the event if a handle has been clicked.
mxVertexHandler.prototype.start = function(x,
y,
index)
Starts the handling of the mouse gesture.
mxVertexHandler.prototype.mouseMove = function(sender,
me)
Handles the event by updating the preview.
mxVertexHandler.prototype.mouseUp = function(sender,
me)
Handles the event by applying the changes to the geometry.
mxVertexHandler.prototype.reset = function()
Resets the state of this handler.
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.
mxGraph.prototype.resizeCell = function(cell,
bounds)
Sets the bounds of the given cell using resizeCells.
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.
mxVertexHandler.prototype.redraw = function()
Redraws the handles and the preview.
mxVertexHandler.prototype.drawPreview = function()
Redraws the preview.
mxVertexHandler.prototype.destroy = function()
Destroys the handler and all its resources and DOM nodes.
mxGraph.prototype.createHandler = function(state)
Creates a new handler for the given cell state.
Close