mxPanningHandler

Event handler that pans and creates popupmenus.  To use the left mousebutton for panning without interfering with cell moving and resizing, use <isUseLeftButton> and <isIgnoreCell>.  For grid size steps while panning, use useGrid.  This handler is built-into <mxGraph.panningHandler> and enabled using mxGraph.setPanning.

Summary
mxPanningHandlerEvent handler that pans and creates popupmenus.
Functions
mxPanningHandlerConstructs an event handler that creates a mxPopupMenu and pans the graph.
Events
mxEvent.PAN_STARTFires when the panning handler changes its <active> state to true.
mxEvent.PANFires while handle is processing events.
mxEvent.PAN_ENDFires when the panning handler changes its <active> state to false.
Variables
graphReference to the enclosing mxGraph.
useLeftButtonForPanningSpecifies if panning should be active for the left mouse button.
usePopupTriggerSpecifies if mxEvent.isPopupTrigger should also be used for panning.
ignoreCellSpecifies if panning should be active even if there is a cell under the mousepointer.
previewEnabledSpecifies if the panning should be previewed.
useGridSpecifies if the panning steps should be aligned to the grid size.
panningEnabledSpecifies if panning should be enabled.
pinchEnabledSpecifies if pinch gestures should be handled as zoom.
maxScaleSpecifies the maximum scale.
minScaleSpecifies the minimum scale.
dxHolds the current horizontal offset.
dyHolds the current vertical offset.
startXHolds the x-coordinate of the start point.
startYHolds the y-coordinate of the start point.
Functions
isActiveReturns true if the handler is currently active.
isPanningEnabledReturns panningEnabled.
setPanningEnabledSets panningEnabled.
isPinchEnabledReturns pinchEnabled.
setPinchEnabledSets pinchEnabled.
isPanningTriggerReturns true if the given event is a panning trigger for the optional given cell.
isForcePanningEventReturns true if the given mxMouseEvent should start panning.
mouseDownHandles the event by initiating the panning.
startStarts panning at the given event.
consumePanningTriggerConsumes the given mxMouseEvent if it was a panning trigger in mouseDown.
mouseMoveHandles the event by updating the panning on the graph.
mouseUpHandles the event by setting the translation on the view or showing the popupmenu.
zoomGraphZooms the graph to the given value and consumed the event if needed.
resetResets the state of this handler.
panGraphPans graph by the given amount.
destroyDestroys the handler and all its resources and DOM nodes.

Functions

mxPanningHandler

Constructs an event handler that creates a mxPopupMenu and pans the graph.

Events

mxEvent.PAN_START

Fires when the panning handler changes its <active> state to true.  The <code>event</code> property contains the corresponding mxMouseEvent.

mxEvent.PAN

Fires while handle is processing events.  The <code>event</code> property contains the corresponding mxMouseEvent.

mxEvent.PAN_END

Fires when the panning handler changes its <active> state to false.  The <code>event</code> property contains the corresponding mxMouseEvent.

Variables

graph

mxPanningHandler.prototype.graph

Reference to the enclosing mxGraph.

useLeftButtonForPanning

mxPanningHandler.prototype.useLeftButtonForPanning

Specifies if panning should be active for the left mouse button.  Setting this to true may conflict with mxRubberband.  Default is false.

usePopupTrigger

mxPanningHandler.prototype.usePopupTrigger

Specifies if mxEvent.isPopupTrigger should also be used for panning.

ignoreCell

mxPanningHandler.prototype.ignoreCell

Specifies if panning should be active even if there is a cell under the mousepointer.  Default is false.

previewEnabled

mxPanningHandler.prototype.previewEnabled

Specifies if the panning should be previewed.  Default is true.

useGrid

mxPanningHandler.prototype.useGrid

Specifies if the panning steps should be aligned to the grid size.  Default is false.

panningEnabled

mxPanningHandler.prototype.panningEnabled

Specifies if panning should be enabled.  Default is true.

pinchEnabled

mxPanningHandler.prototype.pinchEnabled

Specifies if pinch gestures should be handled as zoom.  Default is true.

maxScale

mxPanningHandler.prototype.maxScale

Specifies the maximum scale.  Default is 8.

minScale

mxPanningHandler.prototype.minScale

Specifies the minimum scale.  Default is 0.01.

dx

mxPanningHandler.prototype.dx

Holds the current horizontal offset.

dy

mxPanningHandler.prototype.dy

Holds the current vertical offset.

startX

mxPanningHandler.prototype.startX

Holds the x-coordinate of the start point.

startY

mxPanningHandler.prototype.startY

Holds the y-coordinate of the start point.

Functions

isActive

mxPanningHandler.prototype.isActive = function()

Returns true if the handler is currently active.

isPanningEnabled

mxPanningHandler.prototype.isPanningEnabled = function()

Returns panningEnabled.

setPanningEnabled

mxPanningHandler.prototype.setPanningEnabled = function(value)

Sets panningEnabled.

isPinchEnabled

mxPanningHandler.prototype.isPinchEnabled = function()

Returns pinchEnabled.

setPinchEnabled

mxPanningHandler.prototype.setPinchEnabled = function(value)

Sets pinchEnabled.

isPanningTrigger

mxPanningHandler.prototype.isPanningTrigger = function(me)

Returns true if the given event is a panning trigger for the optional given cell.  This returns true if control-shift is pressed or if usePopupTrigger is true and the event is a popup trigger.

isForcePanningEvent

mxPanningHandler.prototype.isForcePanningEvent = function(me)

Returns true if the given mxMouseEvent should start panning.  This implementation always returns true if ignoreCell is true or for multi touch events.

mouseDown

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

Handles the event by initiating the panning.  By consuming the event all subsequent events of the gesture are redirected to this handler.

start

mxPanningHandler.prototype.start = function(me)

Starts panning at the given event.

consumePanningTrigger

mxPanningHandler.prototype.consumePanningTrigger = function(me)

Consumes the given mxMouseEvent if it was a panning trigger in mouseDown.  The default is to invoke mxMouseEvent.consume.  Note that this will block any further event processing.  If you haven’t disabled built-in context menus and require immediate selection of the cell on mouseDown in Safari and/or on the Mac, then use the following code:

mxPanningHandler.prototype.consumePanningTrigger = function(me)
{
  if (me.evt.preventDefault)
  {
    me.evt.preventDefault();
  }

  // Stops event processing in IE
  me.evt.returnValue = false;

  // Sets local consumed state
  if (!mxClient.IS_SF && !mxClient.IS_MAC)
  {
    me.consumed = true;
  }
};

mouseMove

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

Handles the event by updating the panning on the graph.

mouseUp

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

Handles the event by setting the translation on the view or showing the popupmenu.

zoomGraph

mxPanningHandler.prototype.zoomGraph = function(evt)

Zooms the graph to the given value and consumed the event if needed.

reset

mxPanningHandler.prototype.reset = function()

Resets the state of this handler.

panGraph

mxPanningHandler.prototype.panGraph = function(dx,
dy)

Pans graph by the given amount.

destroy

mxPanningHandler.prototype.destroy = function()

Destroys the handler and all its resources and DOM nodes.

Basic popup menu.
mxPanningHandler.prototype.graph
Reference to the enclosing mxGraph.
Extends mxEventSource to implement a graph component for the browser.
mxPanningHandler.prototype.useLeftButtonForPanning
Specifies if panning should be active for the left mouse button.
mxPanningHandler.prototype.usePopupTrigger
Specifies if mxEvent.isPopupTrigger should also be used for panning.
isPopupTrigger: function(evt)
Returns true if the event is a popup trigger.
mxPanningHandler.prototype.ignoreCell
Specifies if panning should be active even if there is a cell under the mousepointer.
mxPanningHandler.prototype.previewEnabled
Specifies if the panning should be previewed.
mxPanningHandler.prototype.useGrid
Specifies if the panning steps should be aligned to the grid size.
mxPanningHandler.prototype.panningEnabled
Specifies if panning should be enabled.
mxPanningHandler.prototype.pinchEnabled
Specifies if pinch gestures should be handled as zoom.
mxPanningHandler.prototype.maxScale
Specifies the maximum scale.
mxPanningHandler.prototype.minScale
Specifies the minimum scale.
mxPanningHandler.prototype.dx
Holds the current horizontal offset.
mxPanningHandler.prototype.dy
Holds the current vertical offset.
mxPanningHandler.prototype.startX
Holds the x-coordinate of the start point.
mxPanningHandler.prototype.startY
Holds the y-coordinate of the start point.
mxPanningHandler.prototype.isActive = function()
Returns true if the handler is currently active.
mxPanningHandler.prototype.isPanningEnabled = function()
Returns panningEnabled.
mxPanningHandler.prototype.setPanningEnabled = function(value)
Sets panningEnabled.
mxPanningHandler.prototype.isPinchEnabled = function()
Returns pinchEnabled.
mxPanningHandler.prototype.setPinchEnabled = function(value)
Sets pinchEnabled.
mxPanningHandler.prototype.isPanningTrigger = function(me)
Returns true if the given event is a panning trigger for the optional given cell.
mxPanningHandler.prototype.isForcePanningEvent = function(me)
Returns true if the given mxMouseEvent should start panning.
Base class for all mouse events in mxGraph.
mxPanningHandler.prototype.mouseDown = function(sender,
me)
Handles the event by initiating the panning.
mxPanningHandler.prototype.start = function(me)
Starts panning at the given event.
mxPanningHandler.prototype.consumePanningTrigger = function(me)
Consumes the given mxMouseEvent if it was a panning trigger in mouseDown.
mxPanningHandler.prototype.mouseMove = function(sender,
me)
Handles the event by updating the panning on the graph.
mxPanningHandler.prototype.mouseUp = function(sender,
me)
Handles the event by setting the translation on the view or showing the popupmenu.
mxPanningHandler.prototype.zoomGraph = function(evt)
Zooms the graph to the given value and consumed the event if needed.
mxPanningHandler.prototype.reset = function()
Resets the state of this handler.
mxPanningHandler.prototype.panGraph = function(dx,
dy)
Pans graph by the given amount.
mxPanningHandler.prototype.destroy = function()
Destroys the handler and all its resources and DOM nodes.
mxGraph.prototype.setPanning = function(enabled)
Specifies if panning should be enabled.
Event handler that selects rectangular regions.
mxMouseEvent.prototype.consume = function(preventDefault)
Sets consumed to true and invokes preventDefault on the native event if such a method is defined.
Close