Namespace: Event

SuperMap.Event

Event processing function.

Members

SuperMap.Event.KEY_BACKSPACEnumber

KEY_BACKSPACE

Default Value:
8

SuperMap.Event.KEY_DELETEnumber

KEY_DELETE

Default Value:
46

SuperMap.Event.KEY_DOWNnumber

KEY_DOWN

Default Value:
40

SuperMap.Event.KEY_ESCnumber

KEY_ESC

Default Value:
27

SuperMap.Event.KEY_LEFTnumber

KEY_LEFT

Default Value:
37

SuperMap.Event.KEY_RETURNnumber

KEY_RETURN

Default Value:
13

SuperMap.Event.KEY_RIGHTnumber

KEY_RIGHT

Default Value:
39

SuperMap.Event.KEY_SPACEnumber

KEY_SPACE

Default Value:
32

SuperMap.Event.KEY_TABnumber

KEY_TAB

Default Value:
9

SuperMap.Event.KEY_UPnumber

KEY_UP

Default Value:
38

SuperMap.Event.observersboolean

A hash table cache of the event observers. Keyed by element._eventCacheID

Default Value:
false

Methods

SuperMap.Event._removeElementObservers(elementObservers)

Event.js, line 246
Name Type Description
elementObservers Array.<Object>

Array of (element, name, observer, usecapture) objects, taken directly from hashtable

SuperMap.Event.element(event){HTMLElement}

Event.js, line 95

Cross browser event element detection.

Name Type Description
event Event

The event

Returns:
Type Description
HTMLElement The element that caused the event

SuperMap.Event.findElement(event, tagName){HTMLElement}

Event.js, line 164
Name Type Description
event Event

The event。

tagName string

The label name of the html.

Returns:
Type Description
HTMLElement The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards

SuperMap.Event.isLeftClick(event){boolean}

Event.js, line 122

Determine whether event was caused by a left click.

Name Type Description
event Event

The event

Returns:
Type Description
boolean

SuperMap.Event.isMultiTouch(event){boolean}

Event.js, line 113

Determine whether event was caused by a multi touch

Name Type Description
event Event

The event

Returns:
Type Description
boolean

SuperMap.Event.isRightClick(event){boolean}

Event.js, line 132

Determine whether event was caused by a right mouse click.

Name Type Description
event Event

The event

Returns:
Type Description
boolean

SuperMap.Event.isSingleTouch(event){boolean}

Event.js, line 104

Determine whether event was caused by a single touch

Name Type Description
event Event

The event

Returns:
Type Description
boolean

SuperMap.Event.observe(elementParam, name, observer, useCapture)

Event.js, line 180

The listening event, the handling method for the register event.

Name Type Default Description
elementParam HTMLElement | string

The DOM object or it's id to be listened.

name string

The type name of the listening event.

observer function

processing method of the registered event.

useCapture boolean false optional

Whether or not to capture.

SuperMap.Event.stop(event, allowDefault)

Event.js, line 142

Stops an event from propagating.

Name Type Description
event Event

The event

allowDefault boolean

If true, we stop the event chain but still allow the default browser behaviour (text selection, radio-button clicking, etc) Default false

SuperMap.Event.stopObserving(elementParam, name, observer, useCapture){boolean}

Event.js, line 265

emoves the event listening and registered event handler. Note that only if the properties of the event are identical to those while being observed, the removal of the event can be successful.

Name Type Default Description
elementParam HTMLElement | string

The DOM object or it's id to be listened.

name string

Name of the listened event that need to be removed.

observer function

processing method of the event that need to be removed.

useCapture boolean false optional

Whether or not to capture.

Returns:
Type Description
boolean Whether or not the event observer was removed.

SuperMap.Event.stopObservingElement(elementParam)

Event.js, line 234

Given the id of an element to stop observing, cycle through the element's cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed.

Name Type Description
elementParam HTMLElement | string

-

SuperMap.Event.unloadCache()

Event.js, line 318

Cycle through all the element entries in the events cache and call stopObservingElement on each.