Namespace: Event

SuperMap.Event

事件处理函数.

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)

common/commontypes/Event.js, line 254
Name Type Description
elementObservers Array.<Object>

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

SuperMap.Event.element(event){HTMLElement}

common/commontypes/Event.js, line 98

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}

common/commontypes/Event.js, line 167
Name Type Description
event Event

The event。

tagName string

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}

common/commontypes/Event.js, line 125

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}

common/commontypes/Event.js, line 116

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}

common/commontypes/Event.js, line 135

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}

common/commontypes/Event.js, line 107

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)

common/commontypes/Event.js, line 183

监听事件,注册事件处理方法。

Name Type Default Description
elementParam HTMLElement | string

待监听的 DOM 对象或者其 ID 标识。

name string

监听事件的类别名称。

observer function

注册的事件处理方法。

useCapture boolean false 可选

是否捕获。

SuperMap.Event.stop(event, allowDefault)

common/commontypes/Event.js, line 145

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}

common/commontypes/Event.js, line 273

移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时 保持一致才能确保事件移除成功。

Name Type Default Description
elementParam HTMLElement | string

被监听的 DOM 元素或者其 ID。

name string

需要移除的被监听事件名称。

observer function

需要移除的事件处理方法。

useCapture boolean false 可选

是否捕获。

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

SuperMap.Event.stopObservingElement(elementParam)

common/commontypes/Event.js, line 242

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()

common/commontypes/Event.js, line 326

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