Class PanningHandler

Event handler that pans and creates popupmenus. To use the left mouse button for panning without interfering with cell moving and resizing, use and . For grid size steps while panning, use .

When registered in the Graph.constructor plugins list, it can be enabled using Graph.setPanning.

Event: mxEvent.PAN_START

Fires when the panning handler changes its state to true. The event property contains the corresponding MouseEvent.

Event: mxEvent.PAN

Fires while handle is processing events. The event property contains the corresponding MouseEvent.

Event: mxEvent.PAN_END

Fires when the panning handler changes its state to false. The event property contains the corresponding MouseEvent.

Hierarchy (view full)

Implements

Constructors

Properties

active: boolean = false
dx: number = 0

Holds the current horizontal offset.

dx0: number = 0
dy: number = 0

Holds the current vertical offset.

dy0: number = 0
eventListeners: EventListenerObject[] = []

Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

eventsEnabled: boolean = true

Specifies if events can be fired. Default is true.

eventSource: null | EventTarget = null

Optional source for events. Default is null.

forcePanningHandler: ((sender: EventSource, evt: EventObject) => void)
gestureHandler: ((sender: EventSource, evt: EventObject) => void)
graph: Graph

Reference to the enclosing Graph.

ignoreCell: boolean = false

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

initialScale: number = 0
maxScale: number = 8

Specifies the maximum scale. Default is 8.

minScale: number = 0.01

Specifies the minimum scale. Default is 0.01.

mouseDownEvent: null | InternalMouseEvent = null
mouseUpListener: MouseEventListener
panningEnabled: boolean = false

Specifies if panning should be enabled. Default is false.

panningManager: PanningManager
panningTrigger: boolean = false
pinchEnabled: boolean = true

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

previewEnabled: boolean = true

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

startX: number = 0

Holds the x-coordinate of the start point.

startY: number = 0

Holds the y-coordinate of the start point.

useGrid: boolean = false

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

useLeftButtonForPanning: boolean = false

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

usePopupTrigger: boolean = true

Specifies if Event#isPopupTrigger should also be used for panning.

pluginId: string = 'PanningHandler'

Methods

  • Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

    The parameters of the listener are the sender and an EventObject.

    Parameters

    • name: string
    • funct: Function

    Returns void

  • Consumes the given MouseEvent if it was a panning trigger in ouseDown. The default is to invoke MouseEvent#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:

    consumePanningTrigger(me)
    {
    if (me.evt.preventDefault)
    {
    me.evt.preventDefault();
    }

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

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

    Parameters

    Returns void

  • Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see Utils#bind).

    Example:

    fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))
    

    Parameters

    • evt: EventObject

      EventObject that represents the event.

    • sender: null | EventTarget = null

      Optional sender to be passed to the listener. Default value is the return value of .

    Returns void

  • 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 is true and the event is a popup trigger.

    Parameters

    Returns boolean