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.
mxConstraintHandler | Handles constraints on connection targets. |
Functions | |
mxConstraintHandler | Constructs an new constraint handler. |
Variables | |
pointImage | mxImage to be used as the image for fixed connection points. |
graph | Reference to the enclosing mxGraph. |
enabled | Specifies if events are handled. |
highlightColor | Specifies the color for the highlight. |
Functions | |
isEnabled | Returns true if events are handled. |
setEnabled | Enables or disables event handling. |
reset | Resets the state of this handler. |
getTolerance | Returns the tolerance to be used for intersecting connection points. |
getImageForConstraint | Returns the tolerance to be used for intersecting connection points. |
isEventIgnored | Returns true if the given mxMouseEvent should be ignored in update. |
isStateIgnored | Returns true if the given state should be ignored. |
destroyIcons | Destroys the <focusIcons> if they exist. |
destroyFocusHighlight | Destroys the <focusHighlight> if one exists. |
isKeepFocusEvent | Returns true if the current focused state should not be changed for the given event. |
getCellForEvent | Returns the cell for the given event. |
update | Updates the state of this handler based on the given mxMouseEvent. |
redraw | Transfers the focus to the given state as a source or target terminal. |
setFocus | Transfers the focus to the given state as a source or target terminal. |
createHighlightShape | Create the shape used to paint the highlight. |
intersects | Returns true if the given icon intersects the given rectangle. |
destroy | Destroy this handler. |
function mxConstraintHandler( graph )
Constructs an new constraint handler.
graph | Reference to the enclosing mxGraph. |
factoryMethod | Optional 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. |
mxConstraintHandler.prototype.pointImage
mxImage to be used as the image for fixed connection points.
mxConstraintHandler.prototype.graph
Reference to the enclosing mxGraph.
mxConstraintHandler.prototype.highlightColor
Specifies the color for the highlight. Default is mxConstants.DEFAULT_VALID_COLOR.
mxConstraintHandler.prototype.isEnabled = function()
Returns true if events are handled. This implementation returns enabled.
mxConstraintHandler.prototype.setEnabled = function( enabled )
Enables or disables event handling. This implementation updates enabled.
enabled | Boolean that specifies the new enabled state. |
mxConstraintHandler.prototype.getTolerance = function( me )
Returns the tolerance to be used for intersecting connection points. This implementation returns mxGraph.tolerance.
me | mxMouseEvent whose tolerance should be returned. |
mxConstraintHandler.prototype.isEventIgnored = function( me, source )
Returns true if the given mxMouseEvent should be ignored in update. This implementation always returns false.
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.
Constructs an new constraint handler.
function mxConstraintHandler( graph )
mxImage to be used as the image for fixed connection points.
mxConstraintHandler.prototype.pointImage
Reference to the enclosing mxGraph.
mxConstraintHandler.prototype.graph
Specifies if events are handled.
mxConstraintHandler.prototype.enabled
Specifies the color for the highlight.
mxConstraintHandler.prototype.highlightColor
Returns true if events are handled.
mxConstraintHandler.prototype.isEnabled = function()
Enables or disables event handling.
mxConstraintHandler.prototype.setEnabled = function( enabled )
Resets the state of this handler.
mxConstraintHandler.prototype.reset = function()
Returns the tolerance to be used for intersecting connection points.
mxConstraintHandler.prototype.getTolerance = function( me )
Returns the tolerance to be used for intersecting connection points.
mxConstraintHandler.prototype.getImageForConstraint = function( state, constraint, point )
Returns true if the given mxMouseEvent should be ignored in update.
mxConstraintHandler.prototype.isEventIgnored = function( me, source )
Updates the state of this handler based on the given mxMouseEvent.
mxConstraintHandler.prototype.update = function( me, source, existingEdge, point )
Returns true if the given state should be ignored.
mxConstraintHandler.prototype.isStateIgnored = function( state, source )
Destroys the focusIcons if they exist.
mxConstraintHandler.prototype.destroyIcons = function()
Destroys the focusHighlight if one exists.
mxConstraintHandler.prototype.destroyFocusHighlight = function()
Returns true if the current focused state should not be changed for the given event.
mxConstraintHandler.prototype.isKeepFocusEvent = function( me )
Returns the cell for the given event.
mxConstraintHandler.prototype.getCellForEvent = function( me, point )
Transfers the focus to the given state as a source or target terminal.
mxConstraintHandler.prototype.redraw = function()
Transfers the focus to the given state as a source or target terminal.
mxConstraintHandler.prototype.setFocus = function( me, state, source )
Create the shape used to paint the highlight.
mxConstraintHandler.prototype.createHighlightShape = function()
Returns true if the given icon intersects the given rectangle.
mxConstraintHandler.prototype.intersects = function( icon, mouse, source, existingEdge )
Destroy this handler.
mxConstraintHandler.prototype.destroy = function()
Specifies the default valid color.
DEFAULT_VALID_COLOR: '#00FF00'
Tolerance for a move to be handled as a single click.
mxGraph.prototype.tolerance