Nokia Maps API Reference

Contents

Interface nokia.maps.map.Object.Event

Interface Summary

This class defines the interface that must be supported by all events fired by a nokia.maps.map.Object or its derived classes, including the nokia.maps.map.Display class. These classes therefore implement this interface.

This class does not exist, but is documented here to record the event properties. All events are ultimately instances of the class nokia.maps.dom.Event and have the properties described here.

Before you continue reading, please ensure that you are familiar with the normal DOM event behavior as explained, for example, in the documentation for the class nokia.maps.dom.EventTarget or in the corresponding W3C DOM Event Level 3 specification

Dispatch

Map objects do not follow the event dispatch pattern common in the DOM tree, because unlike normal DOM objects, they can be part of multiple map containers and so it can have multiple parents. For this reason a nokia.maps.map.Object.Event has the property display to identify the nokia.maps.map.Display instance in which the event occurred to help establish the correct propagation path. For example, if the user clicks on a marker, a DOM click event with the map.Display instance as target is generated by the browser, but because the browser does not know about the markers (at least in some rendering engines), the display itself must find the map objects under the mouse cursor and modify the propagation path. Furthermore, it needs to apply the nokia.maps.map.Object.Event interface to that DOM event with the special properties display, displayX, displayY and displayObjects.

The nokia.maps.dom.EventTarget#dispatch() method does not generate the propagation path simply by following the property parentNode. Instead, it intercepts the dispatched events, allows the class nokia.maps.map.Display to find the target and build the propagation path so that map objects under the cursor are treated like normal DOM nodes.

Separate the data model from the view tree

The modified event dispatch model permits dispatch of visual events that are separate from the data model events. In addition to the hierarchy of map objects within instances of map.Display, a further document hierarchy for all map objects may be present and these objects can act as event targets. Therefore, a single data model can be maintained alongside different display-related view models. This is a strength of the event model. While remaining compatible with the DOM event system, it allows you to maintain a document data model alongside the visual representation, using the same objects for the view trees as well as for the data model.

In addition, events can flow over into the normal DOM tree so that you can capture events fired by the display as well as those fired within the normal DOM tree. For example, if a div element holds both the map and the UI components, you can use the same listeners to process map events and UI events.

Listener notes

Registering listeners on map objects is simlar to registering listeners on DOM nodes, using the class nokia.maps.dom.EventTarget. Note that the listeners are called for all events that reach the map objects. Therefore you must check the property display to see if an event is related to a display or a DOM event, and to which map.Display instance it belongs.

Method Summary
cancel () : nokia.maps.dom.Event This method cancels the given event.
clone () : nokia.maps.dom.Event This method clones the given event without cloning the properties (non-recursive cloning only).
preventDefault () : nokia.maps.dom.Event This method cancels the default action for the given event.
preventUnload (msg) : nokia.maps.dom.Event This method can be used only when the given event is of the type "beforeunload" to ask the user to confirm whether he wants to leave the page.
stopImmediatePropagation () : nokia.maps.dom.Event This method prevents other event listeners from being triggered and, in contrast to Event.stopPropagation(), its effect is immediate.
stopPropagation () : nokia.maps.dom.Event This method prevents other event listeners from being triggered, but its effect is deferred until all event listeners attached on the Event.currentTarget have been triggered.
Field Summary
Number AT_TARGET This field is an event phase identifier, indicating the target phase, which means it is being evaluated at the event target.
Number BUBBLING_PHASE This field is an event phase identifier, indicating the bubbling phase.
Number CAPTURING_PHASE This field is an event phase identifier, indicating the capture phase.
Number PROPAGATION_OK This field is an identifier, indicating that the propagation of the event has not been stopped.
Number PROPAGATION_STOP This field is an identifier, indicating that the propagation of the event has been stopped.
Number PROPAGATION_STOP_IMMEDIATE This field is an identifier, indicating that the propagation of the event has been stopped with immediate effect.
Boolean bubbles This property indicates whether the event is a bubbling event (true) or not (false).
Boolean canBubble This property indicates whether the event can bubble (true) or not (false).
Boolean canSicker This property indicates whether the event can sicker (whether in the capture phase, listeners can be iterated from the top down) or not.
Boolean cancelable This property indicates whether or not an event can have its default action canceled (prevented).
nokia.maps.dom.EventTarget currentTarget This property indicates the object whose eventListeners are currently being processed.
Boolean defaultPrevented This property indicates whether preventDefault() has been called for this event.
nokia.maps.map.Display display This property contains the reference to the display within which the event occurred, if applicable.
nokia.maps.map.Object[] displayObjects This property holds an array of all map objects under the event position reflecting the z-index oder of the objects (the first element in the aray is the topmost visible visilble object, and the last one is the object with the highest z-index).
Number displayX This property holds the horizontal pixel position where the event occurred relative to the top-left corner of the display associated with the event.
Number displayY This property holds the vertical pixel position where the event occurred relative to the to the top-left corner of the display associated with the event.
Number eventPhase This property indicates the phase in the event flow the given event has reached.
String namespaceURI This property holds the namespace URI associated with the event or null if it is unspecified.
Event nativeEvent This property holds a reference to the native DOM event on which the given normalized event object is based.
nokia.maps.dom.Page page This property holds a reference to the page to which the given event relates.
Number propagation This property indicates the status of event propagation.
nokia.maps.dom.EventTarget target This property holds the target object of the event.
Number timeStamp This property specifies the time at which the event was created in milliseconds relative to 1970-01-01T00:00:00Z.
String type This property holds the local name of the event type.
Field Detail
This property contains the reference to the display within which the event occurred, if applicable.
nokia.maps.map.Object[] displayObjects
This property holds an array of all map objects under the event position reflecting the z-index oder of the objects (the first element in the aray is the topmost visible visilble object, and the last one is the object with the highest z-index). Note that the event position can be, for exmample the mouse cursor position, the user's finger touch position of a touch screen, or any other position related to the event (see nokia.maps.map.Object.Event#displayX and nokia.maps.map.Object.Event#displayY).

This property may be undefined, if the event is not related to a display or a specific position, which is the case, for example, for keyboard events, map view change events or some customer defined events.

Number displayX
This property holds the horizontal pixel position where the event occurred relative to the top-left corner of the display associated with the event.

This property may be undefined, if the event is not related to a display or a specific position, which is the case, for example, for keyboard events, map view change events or some customer defined events.

Number displayY
This property holds the vertical pixel position where the event occurred relative to the to the top-left corner of the display associated with the event.

This property may be undefined, if the event is not related to a display or a specific position, which is the case, for example, for keyboard events, map view change events or some customer defined events.

Documentation generated on Wed Jun 27 2012 16:54:30 GMT+0200 (CEST).