mxConstraintHandler

Handles constraints on connection targets.  This class is in charge of showing fixed points when the mouse is over a vertex and handles constraints to establish new connections.

Summary
mxConstraintHandlerHandles constraints on connection targets.
Functions
mxConstraintHandlerConstructs an new constraint handler.
Variables
pointImagemxImage to be used as the image for fixed connection points.
graphReference to the enclosing mxGraph.
enabledSpecifies if events are handled.
highlightColorSpecifies the color for the highlight.
Functions
isEnabledReturns true if events are handled.
setEnabledEnables or disables event handling.
resetResets the state of this handler.
getToleranceReturns the tolerance to be used for intersecting connection points.
getImageForConstraintReturns the tolerance to be used for intersecting connection points.
isEventIgnoredReturns true if the given mxMouseEvent should be ignored in update.
isStateIgnoredReturns true if the given state should be ignored.
destroyIconsDestroys the <focusIcons> if they exist.
destroyFocusHighlightDestroys the <focusHighlight> if one exists.
isKeepFocusEventReturns true if the current focused state should not be changed for the given event.
getCellForEventReturns the cell for the given event.
updateUpdates the state of this handler based on the given mxMouseEvent.
redrawTransfers the focus to the given state as a source or target terminal.
setFocusTransfers the focus to the given state as a source or target terminal.
createHighlightShapeCreate the shape used to paint the highlight.
intersectsReturns true if the given icon intersects the given rectangle.
destroyDestroy this handler.

Functions

mxConstraintHandler

function mxConstraintHandler(graph)

Constructs an new constraint handler.

Parameters

graphReference to the enclosing mxGraph.
factoryMethodOptional function to create the edge.  The function takes the source and target mxCell as the first and second argument and returns the mxCell that represents the new edge.

Variables

pointImage

mxConstraintHandler.prototype.pointImage

mxImage to be used as the image for fixed connection points.

graph

mxConstraintHandler.prototype.graph

Reference to the enclosing mxGraph.

enabled

mxConstraintHandler.prototype.enabled

Specifies if events are handled.  Default is true.

highlightColor

mxConstraintHandler.prototype.highlightColor

Specifies the color for the highlight.  Default is mxConstants.DEFAULT_VALID_COLOR.

Functions

isEnabled

mxConstraintHandler.prototype.isEnabled = function()

Returns true if events are handled.  This implementation returns enabled.

setEnabled

mxConstraintHandler.prototype.setEnabled = function(enabled)

Enables or disables event handling.  This implementation updates enabled.

Parameters

enabledBoolean that specifies the new enabled state.

reset

mxConstraintHandler.prototype.reset = function()

Resets the state of this handler.

getTolerance

mxConstraintHandler.prototype.getTolerance = function(me)

Returns the tolerance to be used for intersecting connection points.  This implementation returns mxGraph.tolerance.

Parameters

memxMouseEvent whose tolerance should be returned.

getImageForConstraint

mxConstraintHandler.prototype.getImageForConstraint = function(state,
constraint,
point)

Returns the tolerance to be used for intersecting connection points.

isEventIgnored

mxConstraintHandler.prototype.isEventIgnored = function(me,
source)

Returns true if the given mxMouseEvent should be ignored in update.  This implementation always returns false.

isStateIgnored

mxConstraintHandler.prototype.isStateIgnored = function(state,
source)

Returns true if the given state should be ignored.  This always returns false.

destroyIcons

mxConstraintHandler.prototype.destroyIcons = function()

Destroys the <focusIcons> if they exist.

destroyFocusHighlight

mxConstraintHandler.prototype.destroyFocusHighlight = function()

Destroys the <focusHighlight> if one exists.

isKeepFocusEvent

mxConstraintHandler.prototype.isKeepFocusEvent = function(me)

Returns true if the current focused state should not be changed for the given event.  This returns true if shift and alt are pressed.

getCellForEvent

mxConstraintHandler.prototype.getCellForEvent = function(me,
point)

Returns the cell for the given event.

update

mxConstraintHandler.prototype.update = function(me,
source,
existingEdge,
point)

Updates the state of this handler based on the given mxMouseEvent.  Source is a boolean indicating if the cell is a source or target.

redraw

mxConstraintHandler.prototype.redraw = function()

Transfers the focus to the given state as a source or target terminal.  If the handler is not enabled then the outline is painted, but the constraints are ignored.

setFocus

mxConstraintHandler.prototype.setFocus = function(me,
state,
source)

Transfers the focus to the given state as a source or target terminal.  If the handler is not enabled then the outline is painted, but the constraints are ignored.

createHighlightShape

mxConstraintHandler.prototype.createHighlightShape = function()

Create the shape used to paint the highlight.

Returns true if the given icon intersects the given point.

intersects

mxConstraintHandler.prototype.intersects = function(icon,
mouse,
source,
existingEdge)

Returns true if the given icon intersects the given rectangle.

destroy

mxConstraintHandler.prototype.destroy = function()

Destroy this handler.

function mxConstraintHandler(graph)
Constructs an new constraint handler.
mxConstraintHandler.prototype.pointImage
mxImage to be used as the image for fixed connection points.
Encapsulates the URL, width and height of an image.
mxConstraintHandler.prototype.graph
Reference to the enclosing mxGraph.
Extends mxEventSource to implement a graph component for the browser.
mxConstraintHandler.prototype.enabled
Specifies if events are handled.
mxConstraintHandler.prototype.highlightColor
Specifies the color for the highlight.
mxConstraintHandler.prototype.isEnabled = function()
Returns true if events are handled.
mxConstraintHandler.prototype.setEnabled = function(enabled)
Enables or disables event handling.
mxConstraintHandler.prototype.reset = function()
Resets the state of this handler.
mxConstraintHandler.prototype.getTolerance = function(me)
Returns the tolerance to be used for intersecting connection points.
mxConstraintHandler.prototype.getImageForConstraint = function(state,
constraint,
point)
Returns the tolerance to be used for intersecting connection points.
mxConstraintHandler.prototype.isEventIgnored = function(me,
source)
Returns true if the given mxMouseEvent should be ignored in update.
Base class for all mouse events in mxGraph.
mxConstraintHandler.prototype.update = function(me,
source,
existingEdge,
point)
Updates the state of this handler based on the given mxMouseEvent.
mxConstraintHandler.prototype.isStateIgnored = function(state,
source)
Returns true if the given state should be ignored.
mxConstraintHandler.prototype.destroyIcons = function()
Destroys the focusIcons if they exist.
mxConstraintHandler.prototype.destroyFocusHighlight = function()
Destroys the focusHighlight if one exists.
mxConstraintHandler.prototype.isKeepFocusEvent = function(me)
Returns true if the current focused state should not be changed for the given event.
mxConstraintHandler.prototype.getCellForEvent = function(me,
point)
Returns the cell for the given event.
mxConstraintHandler.prototype.redraw = function()
Transfers the focus to the given state as a source or target terminal.
mxConstraintHandler.prototype.setFocus = function(me,
state,
source)
Transfers the focus to the given state as a source or target terminal.
mxConstraintHandler.prototype.createHighlightShape = function()
Create the shape used to paint the highlight.
mxConstraintHandler.prototype.intersects = function(icon,
mouse,
source,
existingEdge)
Returns true if the given icon intersects the given rectangle.
mxConstraintHandler.prototype.destroy = function()
Destroy this handler.
Cells are the elements of the graph model.
DEFAULT_VALID_COLOR: '#00FF00'
Specifies the default valid color.
mxGraph.prototype.tolerance
Tolerance for a move to be handled as a single click.
Close