Hierarchy (View Summary)

Constructors

  • Constructor: OpenLayers.Handler Construct a handler.

    Parameters: control - {<OpenLayers.Control>} The control that initialized this handler. The control is assumed to have a valid map property; that map is used in the handler's own setMap method. If a map property is present in the options argument it will be used instead. callbacks - {Object} An object whose properties correspond to abstracted events or sequences of browser events. The values for these properties are functions defined by the control that get called by the handler. options - {Object} An optional object whose properties will be set on the handler.

    Parameters

    Returns Handler

Properties

active: boolean

Property: active {Boolean}

CLASS_NAME: string
control: Control

APIProperty: control {<OpenLayers.Control>}. The control that initialized this handler. The control is assumed to have a valid map property - that map is used in the handler's own setMap method.

evt: null | Event

Property: evt {Event} This property references the last event handled by the handler. Note that this property is not part of the stable API. Use of the evt property should be restricted to controls in the library or other applications that are willing to update with changes to the OpenLayers code.

id: string

Property: id {String}

keyMask: number

APIProperty: keyMask {Integer} Use bitwise operators and one or more of the OpenLayers.Handler constants to construct a keyMask. The keyMask is used by . If the keyMask matches the combination of keys down on an event, checkModifiers returns true.

Example: (code) // handler only responds if the Shift key is down handler.keyMask = OpenLayers.Handler.MOD_SHIFT;

// handler only responds if Ctrl-Shift is down
handler.keyMask = OpenLayers.Handler.MOD_SHIFT |
                  OpenLayers.Handler.MOD_CTRL;

(end)

map: Map

Property: map {<OpenLayers.Map>}

touch: boolean

Property: touch {Boolean} Indicates the support of touch events. When touch events are started touch will be true and all mouse related listeners will do nothing.

Methods

  • APIMethod: activate Turn on the handler. Returns false if the handler was already active.

    Returns: {Boolean} The handler was activated.

    Returns boolean

  • Method: callback Trigger the control's named callback with the given arguments

    Parameters: name - {String} The key for the callback that is one of the properties of the handler's callbacks object. args - {Array(*)} An array of arguments (any type) with which to call the callback (defined by the control).

    Parameters

    • name: string
    • args: any[]

    Returns void

  • Method: checkModifiers Check the keyMask on the handler. If no is set, this always returns true. If a is set and it matches the combination of keys down on an event, this returns true.

    Returns: {Boolean} The keyMask matches the keys down on an event.

    Parameters

    Returns boolean

  • APIMethod: deactivate Turn off the handler. Returns false if the handler was already inactive.

    Returns: {Boolean} The handler was deactivated.

    Returns boolean

  • Method: destroy Deconstruct the handler.

    Returns void

  • Method: register register an event on the map

    Parameters

    • name: string
    • method: Function

    Returns void

  • Method: setEvent With each registered browser event, the handler sets its own evt property. This property can be accessed by controls if needed to get more information about the event that the handler is processing.

    This allows modifier keys on the event to be checked (alt, shift, ctrl, and meta cannot be checked with the keyboard handler). For a control to determine which modifier keys are associated with the event that a handler is currently processing, it should access (code)handler.evt.altKey || handler.evt.shiftKey || handler.evt.ctrlKey || handler.evt.metaKey(end).

    Parameters: evt - {Event} The browser event.

    Parameters

    Returns boolean

  • Method: setMap

    Parameters

    Returns void

  • Method: startTouch Start touch events, this method must be called by subclasses in "touchstart" method. When touch events are started will be true and all mouse related listeners will do nothing.

    Returns void

  • Method: unregister unregister an event from the map

    Parameters

    • name: string
    • method: Function

    Returns void